Using GroupBoxes and Panels to hold buttons : GroupBox « GUI Windows Form « C# / C Sharp

C# / C Sharp
1. 2D Graphics
2. Class Interface
3. Collections Data Structure
4. Components
5. Data Types
6. Database ADO.net
7. Design Patterns
8. Development Class
9. Event
10. File Stream
11. Generics
12. GUI Windows Form
13. Language Basics
14. LINQ
15. Network
16. Office
17. Reflection
18. Regular Expressions
19. Security
20. Services Event
21. Thread
22. Web Services
23. Windows
24. XML
25. XML LINQ
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorial
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
C# / C Sharp » GUI Windows Form » GroupBoxScreenshots 
Using GroupBoxes and Panels to hold buttons
Using GroupBoxes and Panels to hold buttons

   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.Point24144 );
         this.messageLabel.Name = "messageLabel";
         this.messageLabel.Size = new System.Drawing.Size17632 );
         this.messageLabel.TabIndex = 2;

         this.byeButton.Location = new System.Drawing.Point9648 );
         this.byeButton.Name = "byeButton";
         this.byeButton.Size = new System.Drawing.Size7232 );
         this.byeButton.TabIndex = 0;
         this.byeButton.Text = "B";

         this.byeButton.Click += new System.EventHandlerthis.byeButton_Click );

         this.mainGroupBox.Controls.AddRangenew System.Windows.Forms.Control[] {
            this.byeButton, this.hiButton } );
         this.mainGroupBox.Location = new System.Drawing.Point2424 );
         this.mainGroupBox.Name = "mainGroupBox";
         this.mainGroupBox.Size = new System.Drawing.Size176104 );
         this.mainGroupBox.TabIndex = 0;
         this.mainGroupBox.TabStop = false;
         this.mainGroupBox.Text = "Main GroupBox";

         this.hiButton.Location = new System.Drawing.Point848 );
         this.hiButton.Name = "hiButton";
         this.hiButton.Size = new System.Drawing.Size7232 );
         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.Point24192 );
         this.mainPanel.Name = "mainPanel";
         this.mainPanel.Size =new System.Drawing.Size176112 );
         this.mainPanel.TabIndex = 1;

         this.rightButton.Location =new System.Drawing.Point26440 );
         this.rightButton.Name = "rightButton";
         this.rightButton.Size =new System.Drawing.Size8040 );
         this.rightButton.TabIndex = 0;
         this.rightButton.Text = "Far Right";
         this.rightButton.Click += new System.EventHandler(this.rightButton_Click );

         this.leftButton.Location =new System.Drawing.Point840 );
         this.leftButton.Name = "leftButton";
         this.leftButton.Size =new System.Drawing.Size8040 );
         this.leftButton.TabIndex = 0;
         this.leftButton.Text = "Far Left";
         this.leftButton.Click +=new System.EventHandlerthis.leftButton_Click );

         this.AutoScaleBaseSize =new System.Drawing.Size513 );
         this.ClientSize =new System.Drawing.Size224317 );
         this.Controls.AddRange(new System.Windows.Forms.Control[] {
               this.messageLabel,this.mainPanel,this.mainGroupBox } );
         this.Name = "GroupBoxPanelExample";
         this.Text = "GroupBoxPanelExample";
         this.mainGroupBox.ResumeLayoutfalse );
         this.mainPanel.ResumeLayoutfalse );
         this.ResumeLayoutfalse );

      }
      [STAThread]
      static void Main() 
      {
         Application.Runnew GroupBoxPanelExample() );
      }

      private void hiButton_Clickobject 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";
      }
   }



           
       
Related examples in the same category
1. Group Box mouse enter eventGroup Box mouse enter event
2. CheckBox inside GroupBox CheckBox inside GroupBox
w__w___w___.__j_a___v_a___2_s_.co_m | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.