Inheritance: System.Windows.Forms.Control
Beispiel #1
0
        public Form1()
        {
            InitializeComponent();
            txtCommand.AccessibleName = "txtCommand";
            textBox3.AccessibleName   = "textBox3";

            this.button4.Click += new System.EventHandler(this.button4_Click);

            TreeNode node = new TreeNode("item 1");

            node.Nodes.Add(new TreeNode("item 1a"));
            treeView1.Nodes.Add(node);
            node = new TreeNode("item 2");
            node.Nodes.Add(new TreeNode("item 2a"));
            node.Nodes.Add(new TreeNode("item 2b"));
            treeView1.Nodes.Add(node);

            table.Columns.Add("Gender", typeof(bool));
            table.Columns.Add("Name", typeof(string));
            table.Columns.Add("Age", typeof(uint));
            DataRow tableRow;

            tableRow     = table.NewRow();
            tableRow [0] = false;
            tableRow [1] = "Alice";
            tableRow [2] = 24;
            table.Rows.Add(tableRow);
            tableRow     = table.NewRow();
            tableRow [0] = true;
            tableRow [1] = "Bob";
            tableRow [2] = 28;
            table.Rows.Add(tableRow);

            dataGridView1.DataSource     = table;
            dataGridView1.AccessibleName = "dataGridView1";

            listView1.AccessibleName = "listView1";
            var view = listView1;

            view.CheckBoxes = true;
            view.View       = View.Details;
            view.Columns.Add("Subcolumn 1", 100, HorizontalAlignment.Left);
            view.Columns.Add("Subcolumn 2", 100, HorizontalAlignment.Center);
            for (int i = 0; i < 10; i++)
            {
                ListViewItem item = new ListViewItem();
                item.Text = "Item " + i;
                item.SubItems.Add("subitem1");
                item.SubItems.Add("subitem2");
                view.Items.Add(item);
            }

            MyControl myCtrl = new MyControl();

            myCtrl.AccessibleName = "My Control";
            myCtrl.Bounds         = new Rectangle(5, 5, 30, 15);
            Controls.Add(myCtrl);

            menuStrip1.AccessibleName = "menuStrip1";
            menuStrip1.Dock           = DockStyle.Top;
            var file = new ToolStripMenuItem("&File");

            file.DropDownItems.Add(new ToolStripMenuItem("&New"));
            file.DropDownItems.Add(new ToolStripMenuItem("&Open"));
            var edit = new ToolStripMenuItem("&Edit");

            edit.DropDownItems.Add(new ToolStripMenuItem("&Undo"));
            edit.DropDownItems.Add(new ToolStripSeparator());
            edit.DropDownItems.Add(new ToolStripMenuItem("&Cut"));
            edit.DropDownItems.Add(new ToolStripMenuItem("&Copy"));
            edit.DropDownItems.Add(new ToolStripMenuItem("&Paste"));
            menuStrip1.Items.Add(file);
            menuStrip1.Items.Add(edit);
            Controls.Add(menuStrip1);

            splitter1.AccessibleName = "splitter1";
            splitter1.Dock           = DockStyle.Left;
            Controls.Add(splitter1);
        }
Beispiel #2
0
		public Form1 ()
		{
			InitializeComponent ();
			txtCommand.AccessibleName = "txtCommand";
			textBox3.AccessibleName = "textBox3";

			this.button4.Click += new System.EventHandler (this.button4_Click);

			TreeNode node = new TreeNode ("item 1");
			node.Nodes.Add (new TreeNode ("item 1a"));
			treeView1.Nodes.Add (node);
			node = new TreeNode ("item 2");
			node.Nodes.Add (new TreeNode ("item 2a"));
			node.Nodes.Add (new TreeNode ("item 2b"));
			treeView1.Nodes.Add (node);

			table.Columns.Add ("Gender", typeof (bool));
			table.Columns.Add ("Name", typeof (string));
			table.Columns.Add ("Age", typeof (uint));
			DataRow tableRow;
			tableRow = table.NewRow ();
			tableRow [0] = false;
			tableRow [1] = "Alice";
			tableRow [2] = 24;
			table.Rows.Add (tableRow);
			tableRow = table.NewRow ();
			tableRow [0] = true;
			tableRow [1] = "Bob";
			tableRow [2] = 28;
			table.Rows.Add (tableRow);

			dataGridView1.DataSource = table;
			dataGridView1.AccessibleName = "dataGridView1";

			listView1.AccessibleName = "listView1";
			var view = listView1;
			view.CheckBoxes = true;
			view.View = View.Details;
			view.Columns.Add ("Subcolumn 1", 100, HorizontalAlignment.Left);
			view.Columns.Add ("Subcolumn 2", 100, HorizontalAlignment.Center);
			for (int i = 0; i < 10; i++) {
				ListViewItem item = new ListViewItem ();
				item.Text = "Item " + i;
				item.SubItems.Add ("subitem1");
				item.SubItems.Add ("subitem2");
				view.Items.Add (item);
			}

			MyControl myCtrl = new MyControl ();
			myCtrl.AccessibleName = "My Control";
			myCtrl.Bounds = new Rectangle (5, 5, 30, 15);
			Controls.Add (myCtrl);

			menuStrip1.AccessibleName = "menuStrip1";
			menuStrip1.Dock = DockStyle.Top;
			var file = new ToolStripMenuItem ("&File");
			file.DropDownItems.Add (new ToolStripMenuItem ("&New"));
			file.DropDownItems.Add (new ToolStripMenuItem ("&Open"));
			var edit = new ToolStripMenuItem ("&Edit");
			edit.DropDownItems.Add (new ToolStripMenuItem ("&Undo"));
			edit.DropDownItems.Add (new ToolStripSeparator ());
			edit.DropDownItems.Add (new ToolStripMenuItem ("&Cut"));
			edit.DropDownItems.Add (new ToolStripMenuItem ("&Copy"));
			edit.DropDownItems.Add (new ToolStripMenuItem ("&Paste"));
			menuStrip1.Items.Add (file);
			menuStrip1.Items.Add (edit);
			Controls.Add (menuStrip1);

			splitter1.AccessibleName = "splitter1";
			splitter1.Dock = DockStyle.Left;
			Controls.Add (splitter1);
		}