void btn_Click(object sender, EventArgs e) { CtlButton btn = (CtlButton)sender; GroupInfo g = btn.Tag as GroupInfo; if (g != null) { if (this._vTypes.Contains(g)) { this._vTypes.Remove(g); } else { this._vTypes.Add(g); } } else { BatchInfo b = (BatchInfo)btn.Tag; if (this._vBatches.Contains(b)) { this._vBatches.Remove(b); } else { this._vBatches.Add(b); } } this.UpdateImage(btn); this.GeneratePreview(this.GetSelection()); }
private void _chkNotAgain_CheckedChanged(object sender, EventArgs e) { if (this._notAgainConstraint.HasValue) { CtlButton firstButton = null; int enabledCount = 0; foreach (CtlButton button in this._buttons) { button.Enabled = (button.DialogResult == this._notAgainConstraint.Value) || (!this._chkNotAgain.Checked); if (button.Enabled) { firstButton = button; enabledCount++; } } if (this._chkNotAgain.Checked && enabledCount == 1) { firstButton.PerformClick(); } } else { if (this._chkNotAgain.Checked && this._buttons.Count == 1) { this._buttons[0].PerformClick(); } } }
private void Set(TextBox textBox, CtlButton button, CheckBox checkBox, ComboBox comboBox, CtlButton comboButton) { this.Set(textBox, button, checkBox); if (comboBox != null) { comboButton.Enabled = comboBox.Enabled = textBox.Enabled; } }
private void Set(TextBox textBox, CtlButton button, CheckBox checkBox) { if (textBox.Enabled = button.Enabled = checkBox.Checked) { if (textBox.TextLength == 0) { button.PerformClick(); } } }
private CtlButton GenerateTypeButton(GroupInfoBase ti) { CtlButton btn = new CtlButton(); btn.Tag = ti; this.UpdateImage(btn); btn.UseDefaultSize = true; btn.Click += this.btn_Click; btn.Margin = new Padding(0, 0, 0, 0); btn.Visible = true; this.toolTip1.SetToolTip(btn, "View " + ti.DisplayName); return(btn); }
/// <summary> /// Constructor. See Show method for parameter descriptions. /// </summary> private FrmMsgBox(MsgBox e) : this() { this.ctlTitleBar1.Text = e.Title; this.ctlTitleBar1.SubText = e.SubTitle; this.label1.Text = e.Message; this.pictureBox1.Image = e.Image; this._chkNotAgain.Visible = e.DontShowAgainId != null; this._notAgainConstraint = e.DontShowAgainValue; if (e.Buttons == null) { e.Buttons = new MsgBoxButton[] { new MsgBoxButton(DialogResult.OK) }; } foreach (MsgBoxButton s in e.Buttons) { CtlButton b = new CtlButton(); b.Text = s.Text; b.Image = s.Image; b.DialogResult = s.Result; b.Visible = true; b.UseDefaultSize = true; this.flowLayoutPanel1.Controls.Add(b); this._buttons.Add(b); } if (e.DefaultButton.HasValue) { this.AcceptButton = this._buttons.First(z => z.DialogResult == e.DefaultButton.Value); } else { this.AcceptButton = this._buttons[0]; } if (e.CancelButton.HasValue) { this.CancelButton = this._buttons.First(z => z.DialogResult == e.CancelButton.Value); } else { this.CancelButton = this._buttons[this._buttons.Count - 1]; } }
private void UpdateImage(CtlButton btn) { if (btn.Image != null) { btn.Image.Dispose(); } GroupInfo g = btn.Tag as GroupInfo; bool vis; if (g != null) { vis = this._vTypes.Contains(g); } else { BatchInfo b = (BatchInfo)btn.Tag; vis = this._vBatches.Contains(b); } btn.Image = UiControls.CreateExperimentalGroupImage(vis, (GroupInfoBase)btn.Tag, false); }
private FrmEditParameters(Core core, AlgoParameterCollection algo, string defaults, bool readOnly) : this() { this._core = core; this._parameters = algo; this.ctlTitleBar1.Text = readOnly ? "View parameters" : "Edit Parameters"; string[] elements = AlgoParameterTypes.ExternalConvertor.ReadFields(defaults); if (algo.HasCustomisableParams) { for (int index = 0; index < algo.Count; index++) { var param = algo[index]; int row = index + 1; this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.AutoSize, 0f)); Label label = new Label() { Text = param.Name, AutoSize = true, Visible = true, Margin = new Padding(8, 8, 8, 8), }; this.tableLayoutPanel1.Controls.Add(label, 0, row); Label label2 = new Label() { Text = param.Type.ToString(), AutoSize = true, Visible = true, Margin = new Padding(8, 8, 8, 8), }; this.tableLayoutPanel1.Controls.Add(label2, 1, row); TextBox textBox = new TextBox() { Dock = DockStyle.Top, Visible = true, Margin = new Padding(8, 8, 8, 8), Text = elements.Length > index ? elements[index] : "", ReadOnly = readOnly, Tag = index, }; textBox.TextChanged += this.TextBox_TextChanged; this.tableLayoutPanel1.Controls.Add(textBox, 2, row); this._textBoxes.Add(textBox); CtlButton button = new CtlButton() { Image = Resources.MnuEnlargeList, Visible = true, UseDefaultSize = true, Margin = new Padding(8, 8, 8, 8), Tag = index, Enabled = !readOnly, }; button.Click += this.button_Click; this.tableLayoutPanel1.Controls.Add(button, 3, row); this.TextBox_TextChanged(textBox, EventArgs.Empty); this.toolTip1.SetToolTip(label, param.Description); this.toolTip1.SetToolTip(label2, param.Description); this.toolTip1.SetToolTip(textBox, param.Description); this.toolTip1.SetToolTip(button, param.Description); } } if (readOnly) { this._btnOk.Visible = false; this._btnCancel.Text = "Close"; } ctlContextHelp1.Bind(this, ctlTitleBar1, toolTip1, CtlContextHelp.EFlags.HelpOnClick | CtlContextHelp.EFlags.HelpOnFocus); }