示例#1
0
文件: Form1.cs 项目: davidsiaw/kubus
 private void AddSimpleTile(SimpleTile basicTile)
 {
     RadioButton btn = new RadioButton();
     btn.Appearance = Appearance.Button;
     btn.Size = new System.Drawing.Size(40, 40);
     btn.Image = basicTile.GetBitmap(0, 0);
     btn.Tag = basicTile;
     btn.Click += new EventHandler((o, evt) =>
     {
         paintTile = (Tile)((RadioButton)o).Tag;
         populatePanel2WithTileEditor();
     });
     flow_tiles.Controls.Add(btn);
 }
示例#2
0
文件: Form1.cs 项目: davidsiaw/kubus
        private void AddBasicTile(SimpleTile tile)
        {
            RadioButton btn = new RadioButton();
            btn.Appearance = Appearance.Button;
            btn.Size = new System.Drawing.Size(40, 40);
            btn.Image = tile.GetBitmap(0, 0);
            btn.Tag = tile;
            btn.Click += new EventHandler((o, evt) =>
            {
                selectedBasicTile = (SimpleTile)((RadioButton)o).Tag;
                var tp = splitContainer4.Panel2;
                tp.Controls.Clear();
                int d = Tile.tilesize / 2;

                if (selectedBasicTile is SimpleTile)
                {
                    var st = selectedBasicTile as SimpleTile;

                    for (int i = 0; i < 4; i++)
                    {
                        Rectangle r = AutoTile94.tileToRawTileIndex[i];
                        PictureBox pb = new PictureBox();
                        pb.Location = new Point(r.X / d * 20, r.Y / d * 20 + 30);
                        pb.Size = new Size(r.Width + 6, r.Height + 6);
                        pb.Image = st.bmp[i];
                        pb.Tag = new KeyValuePair<SimpleTile, int>(st, i);
                        pb.Click += new EventHandler((ob, ev) =>
                        {
                            PictureBox thepb = (PictureBox)ob;
                            KeyValuePair<SimpleTile, int> theat = (KeyValuePair<SimpleTile, int>)thepb.Tag;
                            thepb.Image = currentTile.GetBitmap(0, 0);
                            theat.Key.bmp[theat.Value] = currentTile.bmp[0];
                        });
                        tp.Controls.Add(pb);
                    }
                }

            });
            flow_basictiles.Controls.Add(btn);
        }