C#中imageList动态添加图片问题

来源:百度知道 编辑:UC知道 时间:2024/06/23 13:03:06
C#中imageList动态添加控件中的图片怎么添加啊!
这样给你说吧,我是获取程序的图标,有很多,我获取出来保存在PIC控件里的,我要把这些图标保存进IMAGELIST里,关文件路径什么事啊,不会在把控件里的图片保存文件在添加进去吧,这样麻烦有浪费内存,·

这样会出错,
值不能为空。
参数名: value
要不我不用来问了`。

不会将favicon.ico换成favicon.jpg或favicon.bmp啊…………
将其它PICBOX控件里的图片路径取出存入imageList即可。

msdn中的实例:
C# 复制代码
internal System.Windows.Forms.ImageList ImageList1;

// Create an ImageList Object, populate it, and display
// the images it contains.
private void Button1_Click(System.Object sender,
System.EventArgs e)
{

// Construct the ImageList.
ImageList1 = new ImageList();

// Set the ImageSize property to a larger size
// (the default is 16 x 16).
ImageList1.ImageSize = new Size(112, 112);

// Add two images to the list.
ImageList1.Images.Add(
Image.FromFile("c:\\windows\\FeatherTexture.bmp"));
ImageList1.Images.Add(
Image.FromFile("C:\\windows\\Gone Fishing.bmp"));

// Get a Graphics obje