[ create a new paste ] login | about

Link: http://codepad.org/uj53FLcZ    [ raw code | fork ]

C++, pasted on Oct 10:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace WindowsFormsApplication1 {
    class TabPageIncludes : TabPage {
        private Panel pnl;
        private ControlListView fieldView;

        public TabPageIncludes() {
            Initialize();
        }

        private void Initialize() {
            this.AutoScroll = true;
            //
            // pnl
            //
            pnl = new Panel() { // contains the listView
                Width = 480,
                Height = 488,
                Location = new Point(61, 20),
                AutoScroll = true
            };
            //
            // fieldView
            //
            fieldView = new ControlListView() {
                BorderStyle = BorderStyle.Fixed3D,
                Margin = new Padding(4, 4, 4, 4),
                BackColor = Color.FromArgb(0xF5, 0xFA, 0xFF),
                AlternateColor = Color.FromArgb(0xEF, 0xF6, 0xFF)
            };

            ContextMenu mnu = new ContextMenu();
            mnu.MenuItems.Add("New Field", new EventHandler((object newSender, EventArgs newE) => {
                ListViewItem item = fieldView.AddItem("");
                fieldView.AddControl(new ComboBox(), 1, item.Index);
                fieldView.AddControl(new CheckBox(), 2, item.Index);

                if (fieldView.Items.Count == 19)
                    pnl.Width += 15;
            }));

            fieldView.ContextMenu = mnu;

            fieldView.AddColumn("Field Name", 195);
            fieldView.AddColumn("Data Type", 135, HorizontalAlignment.Center);
            fieldView.AddColumn("Key", 135, HorizontalAlignment.Center);

            fieldView.DetermineInitialSize();

            this.pnl.Controls.Add(fieldView);
            this.Controls.Add(pnl);

            this.Dock = DockStyle.Fill;
        }
    }
}


Create a new paste based on this one


Comments: