在 C# 中使用 StatusStrip
考虑 System.Windows .Forms.StatusStrip。 我已将 StatusStrip 添加到我的 Windows 窗体应用程序中,但遇到了一些问题。
我希望在 StatusStrip 中在左侧锚定一个标签,在右侧锚定一个进度条,但我找不到设置这些属性的方法。
然后我想我可能需要创建两个 StatusStrip 并将它们锚定在表单底部的两侧......但这并没有成功; 除此之外,感觉不太对劲。
Consider System.Windows.Forms.StatusStrip. I have added a StatusStrip to my Windows Forms application, but I am having a few problems.
I would like to have a label anchored at the left and a progressbar anchored on the right in the StatusStrip, but I can't find a way to set these properties.
I then thought that I may need to create two StatusStrips and anchor them on either side of the bottom of the form... That didn't pan out; besides that, it just doesn't feel right.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
只需将标签控件上的
Spring
属性设置为True
就可以了。Just set the
Spring
property on the label control toTrue
and you should be good to go.您要做的是将进度条的对齐属性设置为右。 然后将 StatusStrip 的 LayoutStyle 设置为 HorizontalStackWithOverflow。
What you have to do is set the alignment property of your progressbar to right. Then set the LayoutStyle of the StatusStrip to HorizontalStackWithOverflow.
这可以通过 statusStrip 的默认表格布局来实现,只需在当前标签和进度条之间放置另一个标签并将 Spring 属性设置为 true 即可。
This can be achieved with the default table layout for the statusStrip by simply putting another label between your current label and your progressBar and set the Spring property to true.
您是否尝试过对齐ProgresBarToolStripItem 的 属性设置为 对吗?
Did you tried the Alignment property of ProgresBarToolStripItem set to the Right?
打开你的设计器并设置
this.toolStripStatusLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
Open your Designer and set
this.toolStripStatusLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;