有关IMAGELIST的问题,请大家帮忙

jhlcss 2003-09-30 09:52:42
我怎样把图片添加到imagelist中,再就是下面这段代码中的imageliststream,如何赋值?

比如,在一个项目中有一个Form1和一个Form6,
在Form1中有imageList1资源, 可以通过这种方式访问, 让Form6中的toolbar访问Form1中的ImageList资源

//取Form1的资源
System.Resources.ResourceManager resource = new System.Resources.ResourceManager(typeof(Form1));
//取得imagelist1的资源流
System.Windows.Forms.ImageListStreamer imgliststream = ((System.Windows.Forms.ImageListStreamer)(resource.GetObject("imageList1.ImageStream")));
//给Form6中的ImageList赋值
ImageList imglist = new ImageList();
imglist.ImageStream = imgliststream;
toolBar1.ImageList = imglist;
//设置工具条图标索引
toolBar1.Buttons[0].ImageIndex = 0;
toolBar1.Buttons[1].ImageIndex = 1;
...全文
45 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
PlayIrrrr 2003-09-30
  • 打赏
  • 举报
回复
同上
MLeo 2003-09-30
  • 打赏
  • 举报
回复
imageList1.Images.Add(new Bitmap("c:\\a.bmp"));
jhlcss 2003-09-30
  • 打赏
  • 举报
回复
up

110,502

社区成员

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

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

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