展开全部
imageList1.Images[index] index 为索引,或者
imageList1.Images[key] key 为图片的名称(唯一)
imageList1.Images[key] key 为图片的名称(唯一)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
启帆信息
2024-11-19 广告
2024-11-19 广告
启帆信息是英伟达中国区代理商,原厂授权代理,提供全面的软件技术解决方案以及NVIDIA以太网产品、交换机等产品,欢迎前来咨询!...
点击进入详情页
本回答由启帆信息提供
展开全部
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 object from the form's handle.
Graphics theGraphics = Graphics.FromHwnd(this.Handle);
// Loop through the images in the list, drawing each image.
for(int count = 0; count < ImageList1.Images.Count; count++)
{
ImageList1.Draw(theGraphics, new Point(85, 85), count);
// Call Application.DoEvents to force a repaint of the form.
Application.DoEvents();
// Call the Sleep method to allow the user to see the image.
System.Threading.Thread.Sleep(1000);
}
}
明白吗?难道你会认为imageList.Images.Add()是把地址中的图片存放在imageList中???
增加:
ImageList imageList = new ImageList();
imageList.Images.Add(Image.FromFile(@"D:\我的文件\myrice\favicon.ico"));
imageList.Images.Add(Image.FromFile(@"D:\我的文件\myrice\favicon4.ico"));
imageList.Images.Add(Image.FromFile(@"D:\我的文件\myrice\favicon5.ico"));
读取一
this.lb = new GListBox();
lb.ImageList = imageList;
读取二
imageList.Images[a],括号内为索引,表示你要取的序号,不得超过imageList.Images.count的数量,不然会报错。
为什么不去看msdn??
-------------以上回答是我从别处复制的,建议你以后再碰到不会的先在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 object from the form's handle.
Graphics theGraphics = Graphics.FromHwnd(this.Handle);
// Loop through the images in the list, drawing each image.
for(int count = 0; count < ImageList1.Images.Count; count++)
{
ImageList1.Draw(theGraphics, new Point(85, 85), count);
// Call Application.DoEvents to force a repaint of the form.
Application.DoEvents();
// Call the Sleep method to allow the user to see the image.
System.Threading.Thread.Sleep(1000);
}
}
明白吗?难道你会认为imageList.Images.Add()是把地址中的图片存放在imageList中???
增加:
ImageList imageList = new ImageList();
imageList.Images.Add(Image.FromFile(@"D:\我的文件\myrice\favicon.ico"));
imageList.Images.Add(Image.FromFile(@"D:\我的文件\myrice\favicon4.ico"));
imageList.Images.Add(Image.FromFile(@"D:\我的文件\myrice\favicon5.ico"));
读取一
this.lb = new GListBox();
lb.ImageList = imageList;
读取二
imageList.Images[a],括号内为索引,表示你要取的序号,不得超过imageList.Images.count的数量,不然会报错。
为什么不去看msdn??
-------------以上回答是我从别处复制的,建议你以后再碰到不会的先在MSDN中搜索一下
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询