您的位置:首页 > 编程语言 > C#

关于房态图的制作方法(C#)

2010-04-07 21:09 218 查看

效果图如上,代码如下

private void Form3_Load(object sender, EventArgs e)
{

for (int i = 0; i < 30; i++)
{
// Label lb = new Label();
Button lb = new Button();
lb.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
lb.Width = 80;
lb.Height = 80;
lb.Text = i.ToString("000");
lb.BackColor = Color.PowderBlue;
lb.ForeColor = Color.Red;
lb.TextAlign = ContentAlignment.TopCenter;
lb.MouseMove += new MouseEventHandler(button_MouseMove);
lb.MouseLeave += new EventHandler(button_MouseLeave);
lb.Image = Image.FromFile(@"F:/VS2008ImageLibrary/Actions/AddTableHH.bmp");
lb.ImageAlign = ContentAlignment.MiddleCenter;
for (int j = 0; j < 3; j++)
{
Label lb1 = new Label();
lb1.BackColor = Color.SlateGray;
lb1.Location = new Point(j*20+7,60);
lb1.Width = 10;
lb1.Height = 11;
lb.Controls.Add(lb1);
}
this.flowLayoutPanel1.Controls.Add(lb);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: