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

效果图如上,代码如下

  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);
            }
        }

posted on 2010-04-07 21:09  guoxuefeng  阅读(1205)  评论(0编辑  收藏  举报