当前位置:网站首页>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.
边栏推荐
猜你喜欢
攻防演练丨赛宁红方管控平台走进广东三地 助力数字政府网络安全建设
MATLAB | 我也做了一套绘图配色可视化模板
2022年最新重庆建筑安全员模拟题库及答案
go中select语句
Edge Cloud Explained in Simple Depth | 4. Lifecycle Management
Optimization of five data submission methods
ERROR 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your
Architecture Camp | Module 8
网络协议及相关技术详解
PyQt5 rapid development and actual combat 10.2 compound interest calculation && 10.3 refresh blog clicks
随机推荐
IDEA找不到Database解决方法
电商rpa是什么意思?跟电商rpi是一个意思吗?
Centos7 install mysql5.7
Grab the tail of gold, silver and silver, unlock the programmer interview "Artifact of Brushing Questions"
Error IDEA Terminated with exit code 1
matlab as(assert dominance)
Spark学习:为Spark Sql添加自定义优化规则
滑窗法切分数据
战略进攻能力的重要性,要远远高于战略防守能力
C#控件 ToolStripProgressBar 用法
ASM module in SAP Ecommerce Cloud Spartacus UI and Accelerator UI
NameNode (NN) and SecondaryNameNode (2NN) working mechanism
【CPU设计实战】简单流水线CPU设计
Flutter键盘可见性
小试牛刀—猜数字游戏
How does the SAP ABAP OData service support the $filter (filter) operation trial version
IDEA连接MySQL数据库并执行SQL查询操作
聊聊 SAP 产品 UI 上的消息显示机制
ADS与C#通信
Two methods of NameNode failure handling