StatusBar with two panels : StatusBar « GUI Windows Form « C# / C Sharp

Home
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.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » GUI Windows Form » StatusBarScreenshots 
StatusBar with two panels
StatusBar with two panels

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;

    public class Form1 : System.Windows.Forms.Form
    {
        private System.Windows.Forms.RadioButton rdoLarge;
        private System.Windows.Forms.RadioButton rdoSmall;
        private System.Windows.Forms.RadioButton rdoList;
        private System.Windows.Forms.RadioButton rdoDetails;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.StatusBarPanel statusBarPanel1;
        private System.Windows.Forms.StatusBarPanel statusBarPanel2;
        private System.Windows.Forms.StatusBar sbInfo;

        public Form1()
        {
            InitializeComponent();
        }

        private void InitializeComponent()
        {
            this.rdoDetails = new System.Windows.Forms.RadioButton();
            this.sbInfo = new System.Windows.Forms.StatusBar();
            this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
            this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
            this.rdoList = new System.Windows.Forms.RadioButton();
            this.rdoLarge = new System.Windows.Forms.RadioButton();
            this.rdoSmall = new System.Windows.Forms.RadioButton();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit();
            this.groupBox1.SuspendLayout();
            this.SuspendLayout();
            //
            // rdoDetails
            //
            this.rdoDetails.Location = new System.Drawing.Point(896);
            this.rdoDetails.Name = "rdoDetails";
            this.rdoDetails.Size = new System.Drawing.Size(10416);
            this.rdoDetails.TabIndex = 3;
            this.rdoDetails.Text = "Details";
            this.rdoDetails.CheckedChanged += new System.EventHandler(this.rdoDetails_CheckedChanged);
            //
            // sbInfo
            //
            this.sbInfo.Location = new System.Drawing.Point(0277);
            this.sbInfo.Name = "sbInfo";
            this.sbInfo.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
                                                                                                                                                            this.statusBarPanel1,
                                                                                                                                                            this.statusBarPanel2});
            this.sbInfo.ShowPanels = true;
            this.sbInfo.Size = new System.Drawing.Size(55216);
            this.sbInfo.TabIndex = 3;
            //
            // statusBarPanel1
            //
            this.statusBarPanel1.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
            this.statusBarPanel1.Width = 526;
            //
            // statusBarPanel2
            //
            this.statusBarPanel2.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
            this.statusBarPanel2.MinWidth = 0;
            this.statusBarPanel2.Width = 10;
            //
            // rdoList
            //
            this.rdoList.Checked = true;
            this.rdoList.Location = new System.Drawing.Point(872);
            this.rdoList.Name = "rdoList";
            this.rdoList.Size = new System.Drawing.Size(10416);
            this.rdoList.TabIndex = 2;
            this.rdoList.TabStop = true;
            this.rdoList.Text = "List";
            this.rdoList.CheckedChanged += new System.EventHandler(this.rdoList_CheckedChanged);
            //
            // rdoLarge
            //
            this.rdoLarge.Location = new System.Drawing.Point(824);
            this.rdoLarge.Name = "rdoLarge";
            this.rdoLarge.Size = new System.Drawing.Size(9616);
            this.rdoLarge.TabIndex = 0;
            this.rdoLarge.Text = "LargeIcon";
            this.rdoLarge.CheckedChanged += new System.EventHandler(this.rdoLarge_CheckedChanged);

            //
            // rdoSmall
            //
            this.rdoSmall.Location = new System.Drawing.Point(848);
            this.rdoSmall.Name = "rdoSmall";
            this.rdoSmall.Size = new System.Drawing.Size(10416);
            this.rdoSmall.TabIndex = 1;
            this.rdoSmall.Text = "SmallIcon";
            this.rdoSmall.CheckedChanged += new System.EventHandler(this.rdoSmall_CheckedChanged);

            //
            // groupBox1
            //
            this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                                                                                                        this.rdoDetails,
                                                                                                                                                        this.rdoList,
                                                                                                                                                        this.rdoSmall,
                                                                                                                                                        this.rdoLarge});
            this.groupBox1.Location = new System.Drawing.Point(42416);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(120128);
            this.groupBox1.TabIndex = 2;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "View mode";
            //
            // Form1
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(513);
            this.ClientSize = new System.Drawing.Size(552293);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {this.sbInfo,
                                                                       this.groupBox1,
                                                                       });
            this.Name = "Form1";
            this.Text = "StatusBar";
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
            this.groupBox1.ResumeLayout(false);
            this.ResumeLayout(false);

        }
        static void Main()
        {
            Application.Run(new Form1());
        }

        private void rdoLarge_CheckedChanged(object sender, System.EventArgs e)
        {
            RadioButton rdb = (RadioButton)sender;
            if (rdb.Checked)
            {
                this.sbInfo.Panels[1].Text = "Large Icon";
            }
            this.sbInfo.Panels[0].Text = "AAA";
        }

        private void rdoList_CheckedChanged(object sender, System.EventArgs e)
        {
            RadioButton rdb = (RadioButton)sender;
            if (rdb.Checked)
            {
                this.sbInfo.Panels[1].Text = "List";
            }
            this.sbInfo.Panels[0].Text = "BBB";
        }

        private void rdoSmall_CheckedChanged(object sender, System.EventArgs e)
        {
            RadioButton rdb = (RadioButton)sender;
            if (rdb.Checked)
            {
                this.sbInfo.Panels[1].Text = "Small Icon";
            }
            this.sbInfo.Panels[0].Text = "CCC";

        }

        private void rdoDetails_CheckedChanged(object sender, System.EventArgs e)
        {
            RadioButton rdb = (RadioButton)sender;
            if (rdb.Checked)
            {
                this.sbInfo.Panels[1].Text = "Details";
            }
            this.sbInfo.Panels[0].Text = "DDD";
        }
    }


           
       
Related examples in the same category
1.Display message in StatusBar
2.Use Label as status barUse Label as status bar
3.Add icon to statusbarAdd icon to statusbar
4.Display current time on statusbarDisplay current time on statusbar
5.Display menu item alert message on the statusbarDisplay menu item alert message on the statusbar
6.Status bar: display time and prompt message for menu itemStatus bar: display time and prompt message for menu item
7.StatusBar ExampleStatusBar Example
8.Status Strip Example
9.Use StatusBarPanel
10.Add StatusPanels to StatusBar
11.Set Text to Statusbar
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.