当IamgeList大小改变之后,ToolBar里的图片显不出来了

依然白板 2006-10-05 10:06:49
ToolBar使用了一个ImageList里的图片.然后我在程序中动态的改变了ImageList的图片SIZE,接着```ToolBar的图看就看不到了`````

用了toolBar.Refresh(),没用.
...全文
191 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
依然白板 2006-10-05
  • 打赏
  • 举报
回复
this.imageList1.ImageSize =new System.Drawing.Size(this.toolButtonWidth,this.toolButtonHeight);
this.toolBar1.Left = this.toolBarLeft;
this.toolBar1.Top = this.toolBarTop;
this.toolBar1.Width = this.toolButtonWidth*13+116;
this.toolBar1.Height = this.toolButtonHeight+10;
this.toolBar1.ImageList = this.imageList1;
this.toolBar1.Buttons[0].ImageIndex = 0;
this.toolBar1.Buttons[1].ImageIndex = 1;
this.toolBar1.Buttons[3].ImageIndex = 2;
this.toolBar1.Buttons[4].ImageIndex = 3;
this.toolBar1.Buttons[6].ImageIndex = 4;
this.toolBar1.Buttons[7].ImageIndex = 5;
this.toolBar1.Buttons[9].ImageIndex = 6;
this.toolBar1.Buttons[10].ImageIndex = 7;
this.toolBar1.Buttons[11].ImageIndex = 8;
this.toolBar1.Buttons[12].ImageIndex = 9;
this.toolBar1.Buttons[13].ImageIndex = 10;
this.toolBar1.Buttons[14].ImageIndex = 11;
this.toolBar1.Buttons[15].ImageIndex = 12;

这是我的代码``漏写了什么?
feiyun0112 2006-10-05
  • 打赏
  • 举报
回复
重新设置ToolBar的ImageList属性

*****************************************************************************
欢迎使用CSDN论坛阅读器 : CSDN Reader(附全部源代码)
http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html
superliu1122 2006-10-05
  • 打赏
  • 举报
回复
在将图像添加到图像集合之前设置 ImageSize 属性,会导致将图像调整到指定的图像大小。

当将 ImageSize 属性设置为新值时,将重新创建图像列表的 Handle。

因为设置 ImageSize 属性会导致重新创建句柄,所以应在设置 Images 属性之前设置 ImageSize。如果在设置 Images 属性之后,在代码中设置 ColorDepth 或 ImageSize 属性,将会导致删除为 Images 属性设置的图像集合。

110,533

社区成员

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

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

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