Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


CSharp Programming

CSharp > Code Examples

Dock Two Buttons

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
Dock Two Buttons using System; using System.Drawing; using System.Windows.Forms; class TwoButtonsDock: Form { public static void Main() { Application.Run(new TwoButtonsDock()); } public TwoButtonsDock() { ResizeRedraw = true; Button btn = new Button(); btn.Parent = this; btn.Text = "&Larger"; btn.Height = 2 * Font.Height; btn.Dock = DockStyle.Top; btn.Click += new EventHandler(ButtonLargerOnClick); btn = new Button(); btn.Parent = this; btn.Text = "&Smaller"; btn.Height = 2 * Font.Height; btn.Dock = DockStyle.Bottom; btn.Click += new EventHandler(ButtonSmallerOnClick); } void ButtonLargerOnClick(object obj, EventArgs ea) { Console.WriteLine("large"); } void ButtonSmallerOnClick(object obj, EventArgs ea) { Console.WriteLine("small"); } }