2 // System.Windows.Forms Demo app
5 // Joel Basson (jstrike@mweb.co.za)
10 using System.Drawing;
\r
11 using System.Windows.Forms;
\r
16 public class GtkForm : System.Windows.Forms.Form
\r
18 private Button button1 = new Button();
19 private Button button2 = new Button();
20 private Label label1 = new Label();
\r
21 private TextBox text1 = new TextBox();
\r
22 private ProgressBar bar1 = new ProgressBar();
23 private CheckBox check1 = new CheckBox();
\r
24 private RadioButton opt1 = new RadioButton();
25 private RadioButton opt2 = new RadioButton();
26 private GroupBox frame1 = new GroupBox();
27 private PictureBox pbox = new PictureBox();
28 private FileDialog fdialog = new FileDialog();
30 private void InitializeWidgets()
\r
32 button1.Location = new Point(150, 28);
\r
33 button1.Name = "button1";
\r
34 button1.Size = new Size(128, 44);
\r
35 button1.Text = "Apply";
\r
36 button1.Click += new EventHandler(this.button1_Click);
\r
37 button1.Enabled = false;
39 button2.Location = new Point(150, 85);
\r
40 button2.Name = "button2";
\r
41 button2.Size = new Size(128, 44);
\r
42 button2.Text = "File";
\r
43 button2.Click += new EventHandler(this.button2_Click);
45 text1.Location = new Point(320,48);
\r
46 text1.Name = "textBox1";
\r
47 text1.Size = new Size(150, 22);
48 text1.Text = this.button1.Name;
50 bar1.Location = new Point(0, 230);
51 bar1.Size = new Size(512, 20);
52 bar1.Text = "This is a ProgressBar";
55 label1.Location = new Point(330, 20);
56 label1.Text = "This is a Label";
58 check1.Location = new Point(28, 140);
59 check1.Size = new Size(180, 20);
60 check1.Text = "Stretch Image";
61 check1.Checked = false;
63 opt1.Location = new Point(280, 155);
64 opt1.Size = new Size(180, 20);
67 opt2.Location = new Point(280,180);
68 opt2.Size = new Size(180, 20);
69 opt2.Text = "Option2";
71 frame1.Location = new Point(260, 130);
72 frame1.Size = new Size (110, 85);
73 frame1.Text = "Frame1";
75 pbox.Location = new Point (25, 28);
76 pbox.Size = new Size(100, 100);
78 //Add you image name and path below
79 pbox.File = "/home/jstrike/Shared/7804.jpg";
81 this.Controls.AddRange(new System.Windows.Forms.Control[] {
93 this.Size = new Size(512, 250);
\r
102 private void button1_Click(object sender, EventArgs e){
103 pbox.File = fdialog.OpenFile;
104 if (this.check1.Checked) {
105 this.pbox.Stretch = true;
107 if (!this.check1.Checked){
108 this.pbox.Stretch = false;
112 private void button2_Click(object sender, EventArgs e){
\r
113 fdialog.ShowDialog();
114 button1.Enabled = true;
119 public class GtkMain
\r
121 public static void Main()
\r
123 GtkForm form1 = new GtkForm ();
\r
124 form1.Text = "System.Windows.Forms at work!";
\r
125 Application.Run(form1);
\r