public void InsertButton(InfoFormButtonType AfterButtonType, string Text, System.Windows.Forms.DialogResult DialogResult) { Button button = new Button() { Name = string.Format("{0}Button", Text), Text = Text, DialogResult = DialogResult, AutoSize = true }; InsertButton(AfterButtonType, button); }
public void SetButtonText(InfoFormButtonType ButtonType, string Text) { Button button = null; switch (ButtonType) { case InfoFormButtonType.OK: button = oKbutton; break; case InfoFormButtonType.Deatils: button = expandButton; break; case InfoFormButtonType.Send: button = sendButton; break; case InfoFormButtonType.Copy: button = copyButton; break; } if (button != null) { button.Text = Text; } }
public void InsertButton(InfoFormButtonType AfterButtonType, System.Windows.Forms.Button Button) { this.splitContainer3.Panel1.Controls.Add(Button); int x; int offset; List<Button> shiftedButtons = new List<Button>(); if (AfterButtonType == InfoFormButtonType.OK) { x = this.oKbutton.Location.X + this.oKbutton.Width + 5; offset = 10 + Button.Width; shiftedButtons.Add(expandButton); } else { throw new NotImplementedException(); } Button.Location = new Point(x, this.oKbutton.Location.Y); foreach (Button button in shiftedButtons) { button.Location = new Point(button.Location.X + offset, button.Location.Y); } }