如何将两个工具标签定位在StatusStrip的不同侧面
我将.NET 6.0与VS2022 IDE一起使用。如何将2个工具statuslabel1放在状态条控制的两个角落。我无法进行任何分组。因此,如果可能的话,请分享一些建议。
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
this.toolStripStatusLabel1.Size = new System.Drawing.Size(151, 20);
this.toolStripStatusLabel1.Text = "SUM Count Average";
//
// toolStripStatusLabel2
//
this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
this.toolStripStatusLabel2.Padding = new System.Windows.Forms.Padding(1000, 0, 0, 0);
this.toolStripStatusLabel2.Size = new System.Drawing.Size(1151, 20);
this.toolStripStatusLabel2.Text = "Elaped Time";
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用或以下解决方案为 statusstrip :
layoutstyle
layoutStyle tohorizontalstackWithAlstackWithRoverFlow
Spring
标签的属性以控制流程。选项1:将LayoutStyle设置为HorizontalStackWithOverFlow
当 layoutstyle 这是因为自定义逻辑它必须支持 spring spring 属性。要解决问题:
设置 layoutstyle statusStrip属性属于
horizontalstackwithoverflow
,然后右(因为toolstripstatuslabel的对齐属性
在设计时隐藏了)。注意:请记住,通过更改布局样式,设置
sprint
不再效果。选项2:使用
spring
标签的属性来控制流量您可以使用3 toolstripstatuslabel tooks;然后,对于中间,将
文本
设置为空,然后将Spring
设置为true以填充空间。然后,在此项目之前的项目将与左侧对齐,然后将项目对准右侧。选项3:代替使用工具条
而不是statusstrip,使用工具条并添加2
注意:主要的UX差异缺少大小握把。
You can use either or the following solutions to set different alignment for the items of StatusStrip:
LayoutStyle
toHorizontalStackWithOverflow
Spring
property of a label to control the flow.Option 1: Set LayoutStyle to HorizontalStackWithOverflow
Setting alignment for the items of StatusStrip doesn't work when the LayoutStyle is Table. That's because of the custom logic that it has to support Spring property. To solve the issue:
Set the LayoutStyle property of the StatusStrip to
HorizontalStackWithOverflow
, then the Alignment of the desired ToolStripStatusLabel to theRight
in code (because the Alignment property ofToolStripStatusLabel
is hidden in design-time).Note: Keep in mind that by changing the layout style, setting
Sprint
has no more effect.Option 2: Use
Spring
property of a label to control the flowYou can use 3 ToolStripStatusLabel items; Then for the middle one, set the
Text
to empty and set theSpring
to true to fill the space. Then the items before the items before this one will be aligned to the left and items after, will be aligned to the right.Option 3: Use a ToolStrip instead
Instead of StatusStrip, use a ToolStrip and add 2 ToolStripLabel, and for the second one, set the Alignment to
Right
.Note: The main UX difference is missing the size grip.