StatusStrip如何添加分割栏?

本文介绍如何在WinForm中通过自定义方法实现类似状态栏的效果,并提供了将ToolStripStatusLabel修改为ToolStripSeparator的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、winform没有,可以加个StatusLabe来模拟这种效,简单点的,Text清空,BorderSides只设左或右,再设置适当的Margin就差不多了,或者是用个Image来达到这个效果;

2、private System.Windows.Forms.ToolStripStatusLabel toolSeparator1;
相应的改为:
private System.Windows.Forms.ToolStripSeparator toolSeparator1;


就是说这个分隔条还是ToolStripSeparator。
这个修改可以在窗体的Form1.Designer.cs文件里直接改,改好后确认无误了再切换到设置界面就可以出现分隔条“|”了。

``` private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); this.StatusStrip1 = new System.Windows.Forms.StatusStrip(); this.ssLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.tslabAccess = new System.Windows.Forms.ToolStripStatusLabel(); this.ssLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); this.tslabRunModel = new System.Windows.Forms.ToolStripStatusLabel(); this.ssLabel3 = new System.Windows.Forms.ToolStripStatusLabel(); this.tslabCommunicate = new System.Windows.Forms.ToolStripStatusLabel(); this.ToolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.权限登录toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.配方管理ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.添加配方ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.切换配方ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.删除配方ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.参数设定toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.通讯ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.在线ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.手动测试ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.定位复测toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.工具编辑toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.手动测试3DToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.复位toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer3 = new System.Windows.Forms.SplitContainer(); this.panel3 = new System.Windows.Forms.Panel(); this.hWindow_Final4 = new ChoiceTech.Halcon.Control.HWindow_Final(); this.hWindowControl1 = new HalconDotNet.HWindowControl(); this.panel4 = new System.Windows.Forms.Panel(); this.button61 = new System.Windows.Forms.Button(); this.button60 = new System.Windows.Forms.Button(); this.button40 = new System.Windows.Forms.Button(); this.button20 = new System.Windows.Forms.Button(); this.button59 = new System.Windows.Forms.Button(); this.button39 = new System.Windows.Forms.Button(); this.button19 = new System.Windows.Forms.Button(); this.button58 = new System.Windows.Forms.Button(); this.button38 = new System.Windows.Forms.Button(); this.button18 = new System.Windows.Forms.Button(); this.button57 = new System.Windows.Forms.Button(); this.button37 = new System.Windows.Forms.Button(); this.button17 = new System.Windows.Forms.Button(); this.button56 = new System.Windows.Forms.Button(); this.button36 = new System.Windows.Forms.Button(); }```解释代码内容
03-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值