当前位置:网站首页>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 right
StatusStrip:
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.
边栏推荐
猜你喜欢
ADS与C#通信
ERROR 1819 (HY000) Your password does not satisfy the current policy requirements
图像大面积缺失,也能逼真修复,新模型CM-GAN兼顾全局结构和纹理细节
CentOS7 - yum install mysql
深圳某游戏研发公司每个工位都装监控,网友:堪比“坐牢”!
C#使用ComboBox控件
CentOS7 安装MySQL 图文详细教程
ERROR 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your
PHP Serialization: eval
网络协议及相关技术详解
随机推荐
Centos7 install mysql5.7
SAP 电商云 Spartacus UI 和 Accelerator UI 里的 ASM 模块
跨境电商小知识之跨境电商物流定义以及方式讲解
模拟量差分和单端(iou计算方法)
五种数据提交方式的优化
ERROR 1819 (HY000) Your password does not satisfy the current policy requirements
log4j2的使用
基于verilog的CRC校验(汇总)
docker部署完mysql无法连接
CentOS7 installation MySQL graphic detailed tutorial
PyQt5快速开发与实战 10.1 获取城市天气预报
0X7FFFFFFF,0X80000000「建议收藏」
电脑重要文件很多,如何备份比较安全?
生产力工具和插件
SAP message TK 248 solved
ERROR 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your
vivado里那些看不懂的原语
ICML2022 | 面向自监督图表示学习的全粒度自语义传播
golang-gin-pprof-使用以及安全问题
NPM 使用介绍