日期:2014-05-17 浏览次数:20860 次
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
label1.AutoSize = false;
label1.Dock = DockStyle.Left;
label1.TextAlign = ContentAlignment.MiddleLeft;
label2.AutoSize = false;
label2.Dock = DockStyle.Right;
label2.TextAlign = ContentAlignment.MiddleRight;
label3.AutoSize = false;
label3.Dock = DockStyle.Top;
label3.TextAlign = ContentAlignment.TopCenter;
label4.AutoSize = false;
label4.Dock = DockStyle.Bottom;
label4.TextAlign = ContentAlignment.BottomCenter;
Label[] labels = { label1, label2, label3, label4 };
foreach (Label l in labels)
{
l.Font = new Font(l.Font.Name, this.Height / 15);
l.Size = new Size(Width / 3, Height / 3);
}
}
private&