Example #1
0
        //将所有图标显示在一个容器内
        public void ShowIcon(FlowLayoutPanel flp)
        {
            Graphics g     = flp.CreateGraphics();
            float    scale = 96 / g.DpiY;

            for (int i = 0; i < IconList.Count; i++)
            {
                Image image    = IconList[i].ToBitmap();
                Image newImage = PictureZoom.ZoomPic(image, scale);

                var pic = new PictureBox {
                    Parent   = flp,
                    Size     = new Size(48, 48),
                    SizeMode = PictureBoxSizeMode.CenterImage,
                    Image    = newImage,
                    Name     = i.ToString(),
                    //设置每个PictureBox间距为4
                    //Margin = new Padding(4),
                };

                pic.Click += (sender, e) => {
                    foreach (PictureBox p in flp.Controls)
                    {
                        p.BackColor = Color.Transparent;
                    }
                    pic.BackColor = selectColor;
                };
            }
        }
Example #2
0
 public void add_Leftpn()
 {
     _flpTop             = new FlowLayoutPanel();
     _flpTop.Width       = 720;
     _flpTop.Height      = 720;
     _flpTop.Location    = new Point(5, 5);
     _flpTop.BorderStyle = BorderStyle.FixedSingle;
     g           = _flpTop.CreateGraphics();
     _cbGamePlay = new ChessBoard();
     _cbGamePlay.create_ChessBoard();
     _flpTop.MouseDown += new MouseEventHandler(Manual_MouseDown);
     this.Controls.Add(_flpTop);
 }