当前位置:网站首页>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.边栏推荐
- PyQt5 rapid development and actual combat 10.1 Get city weather forecast
- 关于MySQL主从复制的数据同步延迟问题
- SAP message TK 248 solved
- C# List用法 List介绍
- How IDEA runs web programs
- 阿里三面:MQ 消息丢失、重复、积压问题,怎么解决?
- The importance of strategic offensive capability is much higher than strategic defensive capability
- P5019 [NOIP2018 提高组] 铺设道路
- What should I do if selenium is reversed?
- FastAPI encapsulates a generic response
猜你喜欢
随机推荐
C# List用法 List介绍
报错:npm ERR code EPERM
CentOS7 installation MySQL graphic detailed tutorial
查看Mysql数据库版本
IDEA如何运行web程序
CentOS7 - yum install mysql
知名无人驾驶公司:文远知行内推
Verilog——基于FPGA的贪吃蛇游戏(VGA显示)
Hard disk partition, expand disk C, no reshipment system, not heavy D dish of software full tutorial.
The cluster of safe mode
PartImageNet物体部件分割(Semantic Part Segmentation)数据集介绍
电商rpa是什么意思?跟电商rpi是一个意思吗?
ECCV2022:在Transformer上进行递归,不增参数,计算量还少!
matlab as(assert dominance)
[CPU Design Practice] Simple Pipeline CPU Design
CentOS7 安装MySQL 图文详细教程
FastAPI encapsulates a generic response
深入浅出边缘云 | 4. 生命周期管理
selenium被反爬了怎么办?
中望3D 2023正式发布,设计仿真制造一体化缩短产品开发周期








