当前位置:网站首页>C# control StatusStrip use
C# control StatusStrip use
2022-07-31 13:15:00 【dusk and starry sky】
StatusStrip control: Status bar control.Usually at the bottom of the form, it is used to display information about objects on the form, or to display application information.
Includes: StatusLabel, progressBar, DropDownButton, and splitButton controls.Text, icons, or both can be displayed.

Example usage: this.toolStripStatusLabel2.Text = DateTime.Now.ToShortDateString();//Display the current date of the system on the taskbar
First learn about StatusStrip: The preferred StatusStrip is a control in the Form, and it is also a large control, which contains many sub-controls, and these sub-controls are stored in the control group.
When we want to use StatusStrip,
First define the StatusStrip,
Then define the ToolStrip control,
Define the ToolStrip control group again,
Third, add the ToolStrip control to the control group,
Fourth, add the control group to the StatusStrip,
Finally, the StatusStrip should be added to the form.
Example:
In this example, a taskbar is added to the Form form, and Test is displayed on the left side of the taskbar.
First, the addition method in design mode is:
Add a StatusStrip control to the form.Add a ToolStripLabel control to the StatusStrip.Set the Text property of the ToolStripLabel control to the message displayed at runtime (ie, Test).
Second, the process of adding in code mode is:
Define StatusStrip
Define Control (ToolStripLabel)
Define control group (ToolStripItem)
Add the control to the control group (Items.AddRange)
Add StatusStrip to Form
public Form1()
{
InitializeComponent();
#region AddStatusStrip
//1. Define the StatusStrip to be added
StatusStrip sb = new StatusStrip();
//2.Define the controls in the StatusStrip project, where ToolStripLabel is a control similar to label, now used to display text
ToolStripLabel tsl = new ToolStripLabel();
//Text content to be displayed
tsl.Text =“Test”;
//3. Define the item to be in StatusStrip
ToolStripItem[] tsi = new ToolStripItem[1];
tsi[0] = tsl;
//4. Add the itemGo to StatusStrip
sb.Items.AddRange(tsi);
//5. Add StatusStrip to the form
this.Controls.Add(sb);
#endregion
}
MenuStrip:
Add the menu bar control MenuStrip on the form, directly press and hold the MenuStrip, and drag it to the Windows Form on the rightStatusStrip:
is used to give some hints to the user in the interface, for example, after logging in to a system, the user name, system time and other information of the logged in person will be displayed on the status bar.The text cannot be edited directly on the status bar, and other controls need to be added to assist.Click the newly added status bar control in the interface shown above, the drop-down menu as shown below will be displayed,
Including label control (StatusLabel), progress bar (ProgressBar), drop-down list button (DropDownButton), split button (SplitButton).
ToolStrip:
Drag the ToolStrip control directly into the Windows Form from the Toolbox.For beauty and interface unity, it should be dragged to the bottom of the menu bar, as shown in the following figure.边栏推荐
猜你喜欢

Error IDEA Terminated with exit code 1

ECCV2022:在Transformer上进行递归,不增参数,计算量还少!

C#控件 ToolStripProgressBar 用法

CentOS7 - yum install mysql

抓住金三银四的尾巴,解锁程序员面试《刷题神器》

How does the SAP ABAP OData service support the $filter (filter) operation trial version

阿里三面:MQ 消息丢失、重复、积压问题,怎么解决?

五种数据提交方式的优化

Invalid bound statement (not found)出现的原因和解决方法

NameNode (NN) 和SecondaryNameNode (2NN)工作机制
随机推荐
/run/NetworkManager占用空间过大
go中select语句
集群中增加数据节点与退役数据节点
基于模糊预测与扩展卡尔曼滤波的野值剔除方法
PyQt5 rapid development and actual combat 10.1 Get city weather forecast
Anaconda安装labelImg图像标注软件
Centos7 install mysql5.7
IDEA找不到Database解决方法
Flutter keyboard visibility
SAP message TK 248 solved
PyQt5 rapid development and actual combat 10.2 compound interest calculation && 10.3 refresh blog clicks
JSP中如何借助response对象实现页面跳转呢?
PyQt5快速开发与实战 9.7 UI层的自动化测试
golang中使用泛型
SAP message TK 248 solved
P5019 [NOIP2018 提高组] 铺设道路
golang八股文整理(持续搬运)
基本语法(一)
ASM外部冗余是否可以替换磁盘
ECCV 2022 | 机器人的交互感知与物体操作