如何将两个工具标签定位在StatusStrip的不同侧面

发布于 2025-01-23 23:59:40 字数 596 浏览 0 评论 0 原文

我将.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";

I am using .NET 6.0 with VS2022 IDE. How to place 2 toolStripStatusLabel1 at two corners of status strip control. I am not able to make any grouping. So please share some suggestions if it is possible.

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

表情可笑 2025-01-30 23:59:40

您可以使用或以下解决方案为 statusstrip

  • set layoutstyle layoutStyle to horizo​​ntalstackWithAlstackWithRoverFlow
  • 或使用或使用 Spring 标签的属性以控制流程。
  • 或者使用工具条。

选项1:将LayoutStyle设置为Horizo​​ntalStackWithOverFlow

layoutstyle 这是因为自定义逻辑它必须支持 spring spring 属性。要解决问题:

设置 layoutstyle statusStrip属性属于 horizo​​ntalstackwithoverflow ,然后右(因为 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:

  • Set LayoutStyle to HorizontalStackWithOverflow
  • OR Use Spring property of a label to control the flow.
  • OR use a ToolStrip instead.

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 the Right in code (because the Alignment property of ToolStripStatusLabel 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 flow

You can use 3 ToolStripStatusLabel items; Then for the middle one, set the Text to empty and set the Spring 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文