C # students use statusstrip

Source: Internet
Author: User
First, let's take a look at statusstrip. The first choice is statusstrip, a control in form. It is also a big control at the same time. It contains many child controls, which are stored in the control group.
So when we use statusstrip, we must first define statusstrip, then define the toolstrip control, define the toolstrip control group again, and third Add the toolstrip control to the control group, fourth, add the control group to statusstrip, and finally add statusstrip to the window.

Example:
In this example, add a role in the Form window, and show "test" on the left side of the role 」.

1. In design mode, add the following method:
Add a statusstrip control to the window. Add a toolstriplabel control on statusstrip. Set the text sensitivity of the toolstriplabel control to the message displayed during running (that is, test ).

2. In the substitution mode, add the process as follows:
1. Define statusstrip
2. Define the control (toolstriplabel)
3. Define the control group (toolstripitem)
4. Add controls to the control group (items. addrange)
5. Add statusstrip to form

Public Form1 ()
{
Initializecomponent ();

# RegionAddstatusstrip

//1.Define the statusstrip to be added
Statusstrip sb= NewStatusstrip ();

//2. Defines controls in the statusstrip project. The toolstriplabel is a label-like control, which is used to display text.
Toolstriplabel TSL =   New Toolstriplabel ();
// Text content to be displayed
TSL. Text =   " Test " ;

// 3. define a project in statusstrip
toolstripitem [] TSI = New toolstripitem [ 1 ];
TSI [ 0 ] = TSL;

//4.Add a category to statusstrip
SB. Items. addrange (TSI );

//5.Add statusstrip to the form
This. Controls. Add (SB );

# Endregion
}

Result:

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.