private void InitializeComponent() { // /* // * PictureBox p. // */ // this.p = new PictureBox(); // this.p.Dock = DockStyle.Fill; // this.p.Location = new Point(0, 0); // this.p.Size = new Size(800, 600); // // this.Paint += new PaintEventHandler(this.p_Paint); /* * Form Alist. */ this.Text = "Alist"; this.Size = new Size(800, 600); // this.Controls.Add(this.p); this.Paint += new PaintEventHandler(this.Alist_Paint); this.MouseDown += new MouseEventHandler(this.Alist_MouseDown); this.MouseMove += new MouseEventHandler(this.Alist_MouseMove); this.MouseUp += new MouseEventHandler(this.Alist_MouseUp); this.f = new MyForm(); this.b = new MyButton(); this.b.Parent = this.f; this.f.Controls.Add(this.b); /* * Calculate position of button so that * it can be center of my awesome form. */ int b_X = (this.b.Parent.Size.Width - this.b.Size.Width) / 2 + this.b.Parent.Location.X; int b_Y = this.b.Parent.Location.Y + this.b.Parent.Size.Height - this.b.Size.Height - 10; this.b.Location = new Point(b_X, b_Y); }
private void InitializeComponent() { // /* // * PictureBox p. // */ // this.p = new PictureBox(); // this.p.Dock = DockStyle.Fill; // this.p.Location = new Point(0, 0); // this.p.Size = new Size(800, 600); // // this.Paint += new PaintEventHandler(this.p_Paint); /* * Form Alist. */ this.Text = "Alist"; this.Size = new Size(800, 600); // this.Controls.Add(this.p); this.Paint += new PaintEventHandler(this.Alist_Paint); this.MouseDown += new MouseEventHandler(this.Alist_MouseDown); this.MouseMove += new MouseEventHandler(this.Alist_MouseMove); this.MouseUp += new MouseEventHandler(this.Alist_MouseUp); this.f = new MyForm(); this.b = new MyButton(); this.b.Parent = this.f; this.f.Controls.Add(this.b); /* * Calculate position of button so that * it can be center of my awesome form. */ int b_X = (this.b.Parent.Size.Width - this.b.Size.Width) / 2 + this.b.Parent.Location.X; int b_Y = this.b.Parent.Location.Y + this.b.Parent.Size.Height - this.b.Size.Height - 10; this.b.Location = new Point(b_X, b_Y); }