c# ToolStrip 的ReSize问题

15641300456 2009-03-10 11:35:43
在ToolStrip 控件内放内个按钮和一个ToolStripComboBox
然后写ToolStrip 的ReSize属性,每个ToolStripComboBox的宽度等于ToolStrip 的宽度减按钮再减一定的数值
当ToolStrip 的宽度发生变化时ToolStripComboBox会自动改变大小,但是我发现一个问题
如果一次调整ToolStrip 的宽度只要右边界超过ToolStripComboBox的右边界这个ToolStripComboBox就会隐藏,然后右边出现一个下三角。
当点击这个下三角时ToolStripComboBox又会出现,而且尺寸已经调整过。
我想应该是ToolStrip 先隐藏了控件,然后再调整这个组件导致。
如何能让系统先执行RESIZE然后再判断是否应该隐藏一些控件。
或者其它方法能解决这个问题。
...全文
538 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
abcd1236386 2009-03-14
  • 打赏
  • 举报
回复
ding
15641300456 2009-03-10
  • 打赏
  • 举报
回复
解决!

设置

this.toolStripComboBox1.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;

就好用了。
15641300456 2009-03-10
  • 打赏
  • 举报
回复
同样会显示溢出菜单


[Quote=引用 1 楼 cja03 的回复:]
//改变地址栏长度
private void toolStrip1_SizeChanged(object sender, EventArgs e)
{
int allWidth = this.toolBrowser.Width;
int widths = 0;
foreach (ToolStripItem item in this.toolBrowser.Items)
{
if (item.Name == this.toolBrowserUrl.Name)
continue;
widths +…
[/Quote]
rqx110 2009-03-10
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 cja03 的回复:]
//改变地址栏长度
private void toolStrip1_SizeChanged(object sender, EventArgs e)
{
int allWidth = this.toolBrowser.Width;
int widths = 0;
foreach (ToolStripItem item in this.toolBrowser.Items)
{
if (item.Name == this.toolBrowserUrl.Name)
continue;
widths +…
[/Quote]
cja03 2009-03-10
  • 打赏
  • 举报
回复
//改变地址栏长度
private void toolStrip1_SizeChanged(object sender, EventArgs e)
{
int allWidth = this.toolBrowser.Width;
int widths = 0;
foreach (ToolStripItem item in this.toolBrowser.Items)
{
if (item.Name == this.toolBrowserUrl.Name)
continue;
widths += item.Width;
}
this.toolBrowserUrl.Width = allWidth - widths - 12;
}

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧