自动调整状态条中的进度条 [英] Autosize a progress bar within a status strip

查看:79
本文介绍了自动调整状态条中的进度条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 StatusStrip 中调整 ToolStripProgressBar 以在时使用可用宽度StatusStrip 宽度变化?

还有另外两个固定大小的项目。

解决方案

不幸的是ToolStripProgressBar没有t支持Spring属性,因此您必须手动执行:

处理StatusStrip.Resize事件,并修改Progress bar.Width属性。

 toolStripProgressBar1.Width = statusDisplay。宽度 -  200; 



不要忘记将ProgressBar.AutoSize属性设置为False,否则每次进行更改都会被忽略。


另一个简单的选项是将正常进度条放在您想要进度的工具条区域的顶部,并将Anchor属性设置为bottom,left,right。比处理resize事件容易得多的解决方案。


啊,ToolStripProgressBard不支持Resize事件,我只是为状态添加一个文本框,然后在它旁边放一个进度条,正如你所说,使用resize事件。

谢谢! :thumbsup:

How can I resize ToolStripProgressBar within a StatusStrip to use the available width when the StatusStrip width changes?
There are two other items which are fixed size.

解决方案

Unfortunately ToolStripProgressBar doesn't support the Spring property, so you have to do it manually:
Handle the StatusStrip.Resize event, and modify the Progress bar.Width property.

toolStripProgressBar1.Width = statusDisplay.Width - 200;


Don't forget to set the ProgressBar.AutoSize property to False or changes will be ignored every time you make them.


Another simple option is to place a normal progress bar on top of the tool strip area you want the progress and set the Anchor properties to bottom, left, right. Much easier solution than handling resize events.


Ah, the ToolStripProgressBard doesn't support a Resize event, I'll just put a text box for status and then a progress bar next to it and use the resize event on that as you say.
Thanks! :thumbsup:


这篇关于自动调整状态条中的进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆