登录
首页 » C#源码 » C#在listView自定义imageList图标列表

C#在listView自定义imageList图标列表

于 2023-03-09 发布 文件大小:45.46 kB
0 260
下载积分: 2 下载次数: 1

代码说明:

C#在listView自定义imageList图标列表,实际上是创建了一个图像列表的Listview列表,我们可以将一些菜单条目做成此类型,以图标的风格展现操作选项,本实例中你可以熟悉imageList、listView1列表项的添加与删除。   下面是关键的代码:   listView1.LargeImageList = imageList1;   imageList1.ImageSize = new Size(37,36);   imageList1.Images.Add(Image.FromFile("01.png"));调用图标显示的图像资源   imageList1.Images.Add(Image.FromFile("02.png"));   listView1.SmallImageList = imageList1;   listView1.Items.Add("明日科技");图标下边显示的文字   listView1.Items.Add("C#编程词典");   listView1.Items[0].ImageIndex = 0;   listView1.Items[1].ImageIndex = 1;

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 7Zip
    This file is part of SevenZipSharp.    SevenZipSharp is free software: you can redistribute it and/or modify    it under the terms of the GNU Lesser General Public License as published by    the Free Software Foundation, either version 3 of the License, or    (at your option) any later version.    SevenZipSharp is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU Lesser General Public License for more details.    You should have received a copy of the GNU Lesser General Public License    along with SevenZipSharp.  If not, see .
    2022-07-20 00:09:31下载
    积分:1
  • C# 根据用户输入的防伪码生成随机数
    C# 根据用户输入的防伪码生成随机数,测试时请输入防伪码的长度和个数(以空格来分开),请键入任意字符以结束,这个过程适时显示生成个数:{0},运行时间:{1}ms。根据指定字符生成随机数,这个在平时应用广泛,希望这个源码在生成随机数方面会给你一定参考。
    2022-02-01 00:12:10下载
    积分:1
  • C# 在密钥容器中创建非对称密钥
    在密钥容器中创建非对称密钥、在密钥容器中删除非对称密钥、在密钥容器中获取非对称密钥,具体的实现代码,请参考如下代码:   private void button1_Click(object sender, EventArgs e)   {//在密钥容器中创建非对称密钥    CspParameters MyCSP = new CspParameters();    MyCSP.KeyContainerName = this.textBox2.Text;    RSACryptoServiceProvider MyRSA = new RSACryptoServiceProvider(MyCSP);    this.textBox1.Text=MyRSA.ToXmlString(true);   }   private void button2_Click(object sender, EventArgs e)   {//在密钥容器中删除非对称密钥    CspParameters MyCSP = new CspParameters();    MyCSP.KeyContainerName = this.textBox2.Text;    RSACryptoServiceProvider MyRSA = new RSACryptoServiceProvider(MyCSP);    MyRSA.PersistKeyInCsp = false;    MyRSA.Clear();    try    {    this.textBox1.Text = MyRSA.ToXmlString(true);    }    catch    {    this.textBox1.Text = "已经删除非对称密钥!";    }   }   private void button3_Click(object sender, EventArgs e)   {//在密钥容器中获取非对称密钥    CspParameters MyCSP = new CspParameters();    MyCSP.KeyContainerName = this.textB
    2022-02-06 13:18:17下载
    积分:1
  • C# wpf着色绘图板 可顺时针、逆时针旋转墨迹
    C# wpf着色绘图板 可顺时针、逆时针旋转墨迹,可选择画笔颜色,可旋转画笔,运行界面如截图所示。
    2022-02-05 17:39:58下载
    积分:1
  • C# 创建一个泛型接口
    C# 创建一个泛型接口的例子,创建一个泛型接口的代码和方法如下:   public interface IGenericInterface   {    T CreateInstance(); //接口中调用CreateInstance方法   }   //实现上面泛型接口的泛型类   //派生约束where T : TI(T要继承自TI)   //构造函数约束where T : new()(T可以实例化)   public class Factory : IGenericInterface where T : TI, new()   {    public TI CreateInstance()//创建一个公共方法CreateInstance    {    return new T();    }   }   class Program   {    static void Main(string[] args)    {    //实例化接口    IGenericInterface factory =   Factory();    //输出指定泛型的类型    Console.WriteLine(factory.CreateInstance().GetType().ToString());    Console.ReadLine();    }   }
    2022-03-11 00:59:39下载
    积分:1
  • C# 复制和删除数据表指定行数据
    C# 复制和删除数据表指定行数据,主要是完成了两项功能,删除目标数据表的选择行的整行数据,将源数据表的选择行数据复制到目标数据表,这两个功能的实现思路和代码演示如下:   private void Form1_Load(object sender, EventArgs e)   {    MySourceTable = new DataTable();    var MyConnectString=@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:Northwind.mdb";    var MySQL = "Select * From 客户";    var MyAdapter=new OleDbDataAdapter(MySQL,MyConnectString);    MyAdapter.Fill(MySourceTable);    this.DataGridView1.DataSource = MySourceTable;    MyTargetTable = MySourceTable.Clone();    this.DataGridView2.DataSource = MyTargetTable;   }   private void Button1_Click(object sender, EventArgs e)   {//将源数据表的选择行数据复制到目标数据表    var MyID= "客户ID=;    MyID = MyID + this.DataGridView1.CurrentRow.Cells[0].Value.ToString() +";    MyTargetTable.ImportRow(this.MySourceTable.Select(MyID)[0]);   }   private void Button2_Click(object sender, EventArgs e)   {//删除目标数据表的选择行的整行数据    var MyID = "客户ID=;    MyID = MyID +this.DataGridView2.CurrentRow.Cells[0].Value.ToString
    2022-04-17 22:21:45下载
    积分:1
  • Visual C# LINQ转换为一对多字典
    Visual C# 转换为一对多字典,构造泛型列表,使用LINQ查找用户代码小于3的列表,此时的query变量的类型是IEnumerable类型,使用ToLookup方法将query转换为一对多字典类型:   ILookup userLookup = query.ToLookup(itm => itm.UserCode);   label1.Text = "ILookup的结果是: ";   foreach (var user in userLookup)//遍历查询结果   {    label1.Text += user.Key;//显示主键    label1.Text += " ";    foreach (var user2 in user)//遍历所有值    {    label1.Text += user2.UserName + " , ";//显示键值    }    label1.Text += " ";   }
    2023-05-18 03:20:03下载
    积分:1
  • C# 使用IPEndPoint类获取终结点的IP地址和端口号
    Visual C# UseIPEndPoint例子,使用IPEndPoint类对象获取终结点的IP地址和端口号,运行生成的Exe文件,得到的结果如图所示:   以下是实现本功能的关键代码:   先实例化IPEndPoint类对象:   IPEndPoint IPEPoint = new IPEndPoint(IPAddress.Parse(textBox1.Text), 80);   //使用IPEndPoint类对象获取终结点的IP地址和端口号   label2.Text = "IP地址:"+IPEPoint.Address.ToString() + " 端口号:" + IPEPoint.Port;
    2022-01-28 05:14:25下载
    积分:1
  • C# 递增运算/递减运算
    C# 简单模拟递增运算、递减运算:   private void repeatButton1_Click(object sender, RoutedEventArgs e)   {//递增运算    Int32 MyNum = Convert.ToInt32(this.textBox1.Text);    this.label1.Content = "正在进行递增运算:";    this.textBox1.Text = ((MyNum + 1).ToString());   }   private void repeatButton2_Click(object sender, RoutedEventArgs e)   {//递减运算    Int32 MyNum = Convert.ToInt32(this.textBox1.Text);    this.label1.Content = "正在进行递减运算:";    this.textBox1.Text = ((MyNum - 1).ToString());   }
    2022-02-26 15:45:23下载
    积分:1
  • C# 判断计算机中是否安装了SQLServer软件
    C# 判断计算机中是否安装了SQLServer软件,那么是如何判断这个呢?主要是判断是还存在SQL服务,获取Windows服务控制器中的内容,然后过滤字符串"MSSQLSERVER",返回的布尔值若为真,则说明电脑中安装有SQLServer软件。然后在WinForm窗口中使用 label1.Text = "本地计算机中已经安装SQL软件";显示字符串提示信息,简单吧?
    2022-04-25 11:08:17下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载