using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
public class GroupBoxPanelExample : System.Windows.Forms.Form
{
private System.Windows.Forms.Button hiButton;
private System.Windows.Forms.Button byeButton;
private System.Windows.Forms.Button leftButton;
private System.Windows.Forms.Button rightButton;
private System.Windows.Forms.GroupBox mainGroupBox;
private System.Windows.Forms.Label messageLabel;
private System.Windows.Forms.Panel mainPanel;
public GroupBoxPanelExample()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.messageLabel = new System.Windows.Forms.Label();
this.byeButton = new System.Windows.Forms.Button();
this.mainGroupBox = new System.Windows.Forms.GroupBox();
this.hiButton = new System.Windows.Forms.Button();
this.mainPanel = new System.Windows.Forms.Panel();
this.rightButton = new System.Windows.Forms.Button();
this.leftButton = new System.Windows.Forms.Button();
this.mainGroupBox.SuspendLayout();
this.mainPanel.SuspendLayout();
this.SuspendLayout();
this.messageLabel.Location = new System.Drawing.Point( 24, 144 );
this.messageLabel.Name = "messageLabel";
this.messageLabel.Size = new System.Drawing.Size( 176, 32 );
this.messageLabel.TabIndex = 2;
this.byeButton.Location = new System.Drawing.Point( 96, 48 );
this.byeButton.Name = "byeButton";
this.byeButton.Size = new System.Drawing.Size( 72, 32 );
this.byeButton.TabIndex = 0;
this.byeButton.Text = "B";
this.byeButton.Click += new System.EventHandler( this.byeButton_Click );
this.mainGroupBox.Controls.AddRange( new System.Windows.Forms.Control[] {
this.byeButton, this.hiButton } );
this.mainGroupBox.Location = new System.Drawing.Point( 24, 24 );
this.mainGroupBox.Name = "mainGroupBox";
this.mainGroupBox.Size = new System.Drawing.Size( 176, 104 );
this.mainGroupBox.TabIndex = 0;
this.mainGroupBox.TabStop = false;
this.mainGroupBox.Text = "Main GroupBox";
this.hiButton.Location = new System.Drawing.Point( 8, 48 );
this.hiButton.Name = "hiButton";
this.hiButton.Size = new System.Drawing.Size( 72, 32 );
this.hiButton.TabIndex = 0;
this.hiButton.Text = "A";
this.hiButton.Click += new System.EventHandler(this.hiButton_Click );
this.mainPanel.AutoScroll = true;
this.mainPanel.BorderStyle =System.Windows.Forms.BorderStyle.FixedSingle;
this.mainPanel.Controls.AddRange(new System.Windows.Forms.Control[] {
this.rightButton,this.leftButton } );
this.mainPanel.Location =new System.Drawing.Point( 24, 192 );
this.mainPanel.Name = "mainPanel";
this.mainPanel.Size =new System.Drawing.Size( 176, 112 );
this.mainPanel.TabIndex = 1;
this.rightButton.Location =new System.Drawing.Point( 264, 40 );
this.rightButton.Name = "rightButton";
this.rightButton.Size =new System.Drawing.Size( 80, 40 );
this.rightButton.TabIndex = 0;
this.rightButton.Text = "Far Right";
this.rightButton.Click += new System.EventHandler(this.rightButton_Click );
this.leftButton.Location =new System.Drawing.Point( 8, 40 );
this.leftButton.Name = "leftButton";
this.leftButton.Size =new System.Drawing.Size( 80, 40 );
this.leftButton.TabIndex = 0;
this.leftButton.Text = "Far Left";
this.leftButton.Click +=new System.EventHandler( this.leftButton_Click );
this.AutoScaleBaseSize =new System.Drawing.Size( 5, 13 );
this.ClientSize =new System.Drawing.Size( 224, 317 );
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.messageLabel,this.mainPanel,this.mainGroupBox } );
this.Name = "GroupBoxPanelExample";
this.Text = "GroupBoxPanelExample";
this.mainGroupBox.ResumeLayout( false );
this.mainPanel.ResumeLayout( false );
this.ResumeLayout( false );
}
[STAThread]
static void Main()
{
Application.Run( new GroupBoxPanelExample() );
}
private void hiButton_Click( object sender, System.EventArgs e )
{
messageLabel.Text= "A pressed";
}
private void byeButton_Click(object sender, System.EventArgs e )
{
messageLabel.Text = "B pressed";
}
private void leftButton_Click(object sender, System.EventArgs e )
{
messageLabel.Text = "Far left pressed";
}
private void rightButton_Click(
object sender, System.EventArgs e )
{
messageLabel.Text = "Far right pressed";
}
}
|