1. Form and interface design-status bar Design

Source: Internet
Author: User

The status bar is used to display the current program status. The status bar can be divided into multiple panels to display content in different States.

011 display the check box in the status bar

It is easy to add a check box to the status bar. You only need to add the status bar to the form, and then drag the check box from the toolbar to the status bar.

1. Create a project. The default form is Form1. Add the StatusBar control to the Form1 form and add the CheckBox control for the status bar from the toolbox.

2. Right-click the StatusBar control and Insert a StatusLabel.

Namespace _ 011_StatusBar {public partial class Form1: Form {public Form1 () {InitializeComponent ();} private void checkbox#checkedchanged (object sender, EventArgs e) {if (this. checkBox1.Checked) {// when checkBox1 is selected, the current system time statusStrip1.Items [0] is displayed in the StatusStrip1 control. text = "Date:" + DateTime. now. toString ();} else {statusStrip1.Items [0]. text = "";}}}}

012 status bar with a progress bar

To implement the status bar with a progress bar, you only need to set the button type of the status bar to ProgressBar. You can set the Step attribute of ProgressBar to specify a specific Value to progressively increase the Value of the Value attribute, and then call the increment mstep method to increase the Value so that the status bar with a progress bar can be implemented.

1. create a project. The default form is Form1. Add the StatusBar control to the Form1 form, Add corresponding buttons to the status bar, select the ProgressBar type from the drop-down menu of the button, and add a timer, the Interval attribute is set to 1000.

2. Set the Value attribute, Maximum attribute, and Step attribute of toolStripProgressBar1.

namespace _012_ProsessStatusBar{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }        private void timer1_Tick(object sender, EventArgs e)        {            while (toolStripProgressBar1.Value < toolStripProgressBar1.Maximum)            {                this.toolStripProgressBar1.PerformStep();            }        }    }}

Add an icon to the status bar

It is easy to add icons to the status bar in. NET4.0. You only need to set the Image attribute of the corresponding status bar panel to the Image to be displayed.

Create a project. The default form is Form1. Add the StatusBar control to the Form1 form, Add corresponding buttons to the status bar, and set the Image attribute of the Add button to the Image to be displayed.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.