public SubclassedControlsUI() { InitializeComponent(); m_bl0 = new BindingListEx <Thing>(); m_bl1 = new BindingListEx <Thing>(); m_bs = new BindingSource <Thing> { DataSource = m_bl0 }; m_bl0.Add(new Thing { Name = "One" }); m_bl0.Add(new Thing { Name = "Two" }); m_bl0.Add(new Thing { Name = "Three" }); m_bl0.Add(new Thing { Name = "Four" }); m_bl1.Add(new Thing { Name = "Apple" }); m_bl1.Add(new Thing { Name = "Banana" }); m_bl1.Add(new Thing { Name = "Cucumber" }); // Tool strip combo box var tscb = new Rylogic.Gui.WinForms.ToolStripComboBox(); tscb.ComboBox.DisplayProperty = nameof(Thing.Name); m_ts.Items.Add(tscb); // Tool strip date time picker var tsdtp = new Rylogic.Gui.WinForms.ToolStripDateTimePicker(); tsdtp.Format = DateTimePickerFormat.Custom; tsdtp.CustomFormat = "yyyy-MM-dd HH:mm:ss"; tsdtp.DateTimePicker.Kind = DateTimeKind.Utc; tsdtp.DateTimePicker.ValueChanged += DateTimeValueChanged; m_ts.Items.Add(tsdtp); // Combo box m_cb.DisplayProperty = nameof(Thing.Name); m_cb.TextChanged += (s, a) => { // The selected item becomes null when the text is changed by the user. // Without this test, changing the selection causes the previously selected // item to have it's text changed because TextChanged is raised before the // binding source position and 'SelectedIndex' are changed. if (m_cb.SelectedItem == null) { m_bs.Current.Name = m_cb.Text; } }; // List Box m_lb.DisplayProperty = nameof(Thing.Name); // Date time picker m_dtp.Kind = DateTimeKind.Utc; m_dtp.MinDate = Rylogic.Gui.WinForms.DateTimePicker.MinimumDateTime.As(DateTimeKind.Utc); m_dtp.MaxDate = Rylogic.Gui.WinForms.DateTimePicker.MaximumDateTime.As(DateTimeKind.Utc); m_dtp.Value = DateTime.UtcNow; m_dtp.ValueChanged += DateTimeValueChanged; // Progress bar timer m_timer.Interval = 20; m_timer.Tick += (s, a) => { if (m_pb.Value < m_pb.Maximum) { ++m_pb.Value; m_pb.Text = $"{m_pb.Value}"; } else { m_timer.Enabled = false; } }; // Browse path m_browse_path.Path = "Some File"; m_browse_path.History = new[] { "File1", "File2" }; m_browse_path.PathChanged += (s, a) => { m_browse_path.AddPathToHistory(); }; // Button to make stuff happen m_btn_test.Click += ChangeSource; m_btn_test.Click += (s, a) => { m_pb.Value = m_pb.Minimum; m_timer.Enabled = true; }; // Value Box var vb_value_flag = true; m_vb_value.Value = 6.28; m_vb_value.ValueChanged += (s, a) => { m_lbl_vb_value.Text = m_vb_value.Value.ToString(); }; m_vb_value.ValueCommitted += (s, a) => { vb_value_flag = !vb_value_flag; m_vb_value.BackColor = vb_value_flag ? Color.Red : Color.Blue; }; // Init binding source ChangeSource(); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ToolStripPositionsUI)); this.m_toolstripcont = new Rylogic.Gui.WinForms.ToolStripContainer(); this.m_menu = new System.Windows.Forms.MenuStrip(); this.menuToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripComboBox1 = new Rylogic.Gui.WinForms.ToolStripComboBox(); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); this.m_toolstrip1 = new System.Windows.Forms.ToolStripLabel(); this.toolStrip2 = new System.Windows.Forms.ToolStrip(); this.m_toolstrip2 = new System.Windows.Forms.ToolStripLabel(); this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); this.toolStrip3 = new System.Windows.Forms.ToolStrip(); this.m_toolstrip3 = new System.Windows.Forms.ToolStripLabel(); this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); this.m_menu_save = new System.Windows.Forms.ToolStripMenuItem(); this.m_menu_load = new System.Windows.Forms.ToolStripMenuItem(); this.m_toolstripcont.LeftToolStripPanel.SuspendLayout(); this.m_toolstripcont.TopToolStripPanel.SuspendLayout(); this.m_toolstripcont.SuspendLayout(); this.m_menu.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.toolStrip2.SuspendLayout(); this.toolStrip3.SuspendLayout(); this.SuspendLayout(); // // m_toolstripcont // // // m_toolstripcont.ContentPanel // this.m_toolstripcont.ContentPanel.Size = new System.Drawing.Size(226, 184); this.m_toolstripcont.Dock = System.Windows.Forms.DockStyle.Fill; // // m_toolstripcont.LeftToolStripPanel // this.m_toolstripcont.LeftToolStripPanel.Controls.Add(this.toolStrip3); this.m_toolstripcont.Location = new System.Drawing.Point(0, 0); this.m_toolstripcont.Name = "m_toolstripcont"; this.m_toolstripcont.Size = new System.Drawing.Size(284, 261); this.m_toolstripcont.TabIndex = 0; this.m_toolstripcont.Text = "toolStripContainer1"; // // m_toolstripcont.TopToolStripPanel // this.m_toolstripcont.TopToolStripPanel.Controls.Add(this.m_menu); this.m_toolstripcont.TopToolStripPanel.Controls.Add(this.toolStrip1); this.m_toolstripcont.TopToolStripPanel.Controls.Add(this.toolStrip2); // // m_menu // this.m_menu.Dock = System.Windows.Forms.DockStyle.None; this.m_menu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuToolStripMenuItem, this.toolStripComboBox1 }); this.m_menu.Location = new System.Drawing.Point(3, 0); this.m_menu.Name = "m_menu"; this.m_menu.Size = new System.Drawing.Size(273, 27); this.m_menu.Stretch = false; this.m_menu.TabIndex = 0; this.m_menu.Text = "menuStrip1"; // // menuToolStripMenuItem // this.menuToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.m_menu_save, this.m_menu_load }); this.menuToolStripMenuItem.Name = "menuToolStripMenuItem"; this.menuToolStripMenuItem.Size = new System.Drawing.Size(50, 23); this.menuToolStripMenuItem.Text = "Menu"; // // toolStripComboBox1 // this.toolStripComboBox1.Name = "toolStripComboBox1"; this.toolStripComboBox1.Size = new System.Drawing.Size(121, 23); // // toolStrip1 // this.toolStrip1.Dock = System.Windows.Forms.DockStyle.None; this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.m_toolstrip1, this.toolStripButton1 }); this.toolStrip1.Location = new System.Drawing.Point(3, 27); this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Size = new System.Drawing.Size(92, 25); this.toolStrip1.TabIndex = 1; // // toolStripButton1 // this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image"))); this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton1.Name = "toolStripButton1"; this.toolStripButton1.Size = new System.Drawing.Size(23, 22); this.toolStripButton1.Text = "toolStripButton1"; // // m_toolstrip1 // this.m_toolstrip1.Name = "m_toolstrip1"; this.m_toolstrip1.Size = new System.Drawing.Size(57, 22); this.m_toolstrip1.Text = "toolstrip1"; // // toolStrip2 // this.toolStrip2.Dock = System.Windows.Forms.DockStyle.None; this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.m_toolstrip2, this.toolStripButton2 }); this.toolStrip2.Location = new System.Drawing.Point(95, 27); this.toolStrip2.Name = "toolStrip2"; this.toolStrip2.Size = new System.Drawing.Size(92, 25); this.toolStrip2.TabIndex = 2; // // m_toolstrip2 // this.m_toolstrip2.Name = "m_toolstrip2"; this.m_toolstrip2.Size = new System.Drawing.Size(57, 22); this.m_toolstrip2.Text = "toolstrip2"; // // toolStripButton2 // this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image"))); this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton2.Name = "toolStripButton2"; this.toolStripButton2.Size = new System.Drawing.Size(23, 22); this.toolStripButton2.Text = "toolStripButton2"; // // toolStrip3 // this.toolStrip3.Dock = System.Windows.Forms.DockStyle.None; this.toolStrip3.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.m_toolstrip3, this.toolStripButton3 }); this.toolStrip3.Location = new System.Drawing.Point(0, 66); this.toolStrip3.Name = "toolStrip3"; this.toolStrip3.Size = new System.Drawing.Size(58, 52); this.toolStrip3.TabIndex = 3; // // m_toolstrip3 // this.m_toolstrip3.Name = "m_toolstrip3"; this.m_toolstrip3.Size = new System.Drawing.Size(56, 15); this.m_toolstrip3.Text = "toolstrip3"; // // toolStripButton3 // this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButton3.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton3.Image"))); this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton3.Name = "toolStripButton3"; this.toolStripButton3.Size = new System.Drawing.Size(56, 20); this.toolStripButton3.Text = "toolStripButton2"; // // m_menu_save // this.m_menu_save.Name = "m_menu_save"; this.m_menu_save.Size = new System.Drawing.Size(164, 22); this.m_menu_save.Text = "Save Positions"; // // m_menu_load // this.m_menu_load.Name = "m_menu_load"; this.m_menu_load.Size = new System.Drawing.Size(164, 22); this.m_menu_load.Text = "Restore Positions"; // // ToolStripPositionsUI // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(284, 261); this.Controls.Add(this.m_toolstripcont); this.MainMenuStrip = this.m_menu; this.Name = "ToolStripPositionsUI"; this.Text = "toolstrip_positions_ui"; this.m_toolstripcont.LeftToolStripPanel.ResumeLayout(false); this.m_toolstripcont.LeftToolStripPanel.PerformLayout(); this.m_toolstripcont.TopToolStripPanel.ResumeLayout(false); this.m_toolstripcont.TopToolStripPanel.PerformLayout(); this.m_toolstripcont.ResumeLayout(false); this.m_toolstripcont.PerformLayout(); this.m_menu.ResumeLayout(false); this.m_menu.PerformLayout(); this.toolStrip1.ResumeLayout(false); this.toolStrip1.PerformLayout(); this.toolStrip2.ResumeLayout(false); this.toolStrip2.PerformLayout(); this.toolStrip3.ResumeLayout(false); this.toolStrip3.PerformLayout(); this.ResumeLayout(false); }