最新文章 (全部类别)
线联ERP - 快捷键
LinERP - 线联ERP - 物料管理
线联ERP - 实施与维护事项
线联ERP - 多帐套主数据关系表
线联ERP - 海康威视人脸考勤机设置固定IP、重启设备操作手册
线联ERP用户操作手册 - BOM管理
LinERP - 线联ERP - 公司内部编码客户、供应商对照表
LinERP - 线联ERP试用版下载
LinERP - 线联ERP客户服务
LinERP - 线联ERP - 表格列头通用弹出菜单
DevExpress V22.1 表格导出PDF支持中文
DevExportTool类 - DevExpress GridView 导出Excel文件通用类
解决DevExpress GridView导出XLS文件报错:Unable to cast object of type 'Windows.Win32.Messageld' to type 'System.IConvertible'
LinERP - 线联ERP - 物料类别操作说明
LinERP - 线联ERP主界面
LinERP - 线联ERP用户操作手册 - 系统登陆
LinERP - 线联ERP - 工具栏按钮列表
LinERP - 线联ERP - 数据查询/数据编辑操作手册
LinERP - 线联ERP - 状态栏操作说明
CMS修改主菜单类别编码CategoryNo
LinERP - 线联ERP简介
明细表支持批量操作删除
C# 图片按钮特效:鼠标移入变浅,移出恢复原样 (ImageButtonHover类)
C# 复制对象属性 CopyProperties扩展方法
线联ERP - 用户操作手册 - 系统初始化
线联ERP - 什么是主账套?
线联ERP - 用户操作手册 - 公司资料设置
C/S快速开发框架旗舰版CSFrameworkV6.0 - VS开发环境配置
修复BUG: CSFramework.EF框架 Remove<T>, RemoveWhere<T>
使用Xlight FTP文件服务器
印章公章在线免费制作
CSFrameworkV6.1旗舰版 - appsettings.json 配置文件增加参数
推荐:使用Photoshop制作ico图标
C#.NET格式化显示:数字末尾不显示0
SQL脚本:更新主表的完成标记FlagFinish=Y
FastReport.NET 设计器汉化&运行时汉化
VS2026/VS2022 关闭 “自动添加 using 命名空间”
C#将List<T>导出为 CSV 文件(Excel 直接打开,无需第三方组件包)
.NET8+EF.Core开发的大型ERP系统客户端4GB电脑测试报告
线联ERP - LinERP HR+考勤系统正式上线
CSFrameworkV6旗舰版 - 复制单据功能
QMS软件简介 | 成本核算报价系统软件简介
QMS - 五金制品行业成本核算报价系统 - 货币资料
QMS - 五金制品行业成本核算报价系统 - 公共字典管理
QMS - 五金制品行业成本核算报价系统 - 物料类别
QMS - 五金制品行业成本核算报价系统 - 物料管理
QMS - 五金制品行业成本核算报价系统 - 图纸文件管理
QMS - 五金制品行业成本核算报价系统 - 供应商管理
QMS - 五金制品行业成本核算报价系统 - 车型费管理
QMS - 五金制品行业成本核算报价系统 - 制程段配置
.net敏捷开发,创造卓越

C# ImageListView控件下载(源代码)


C# ImageListView控件下载(源代码)

ImageListView

By Ozgur Ozcitak

A .NET ListView like control for displaying image files with asynchronously loaded thumbnails.

C#-ImageListView控件下载(源代码)

贴图图片

Introduction

ImageListView is a .NET control for displaying a list of image files. It looks and operates similar to the standard ListView control. Image thumbnails are loaded asynchronously with a separate background thread. The look of the control can be completely customized using custom renderers.


介绍

ImageListView控件是用于显示图片列表的.Net控件。从外观及操作方式上看类似ListView控件。它使用多线程异步加载图片功能,

控件的外观也完全可以定制。

 

Background

This project actually started as an owner-drawn ListView. However, this first version required way too many hacks. Determining the first/last visible items especially proved to be a challenge. Halfway through, I decided to roll my own control. Thus was born the ImageListView.

背景

该控件实际上是从重画ListView控件开始, 但是,第一个版本需要太多的方式去尝试, 特别是确定第一个或最后一个可见的项目被证明是一个挑战。由于这样或那样的问题,我决定推出自己的控件,于是诞生了ImageListView。

 

Using the Code

To use the control, add the ImageListView to your control toolbox and drag it on the form. You can then customize the appearance of the control by changing the view mode (either Thumbnails or Details), thumbnail size, column headers, etc. If you need to include the control in your own control library, drag the source file (and optionally the toolbar icon) to the Solution Explorer, and rename the namespace if you like.


如何使用代码

在工具栏上添加ImageListView控件, 然后拖放控件到窗体上。可以通过改变视图模式定制控件的显示样式(1.略缩图 2.详细内容)
如:略缩图尺寸,列标题等等。。。 如你想将ImageListView加入到自己的控件库, 拖动源代码文件(包括用于工具栏上显示的图标)
到解决方案内。重新命名名字空间就可以了.

 

Custom Rendering

The ImageListViewRenderer class is responsible for drawing the control. This is a public class with virtual functions that can be overridden by derived classes. Derived classes can modify the display size of items and column headers and draw any or all parts of the control.


自定义绘制控件


ImageListViewRenderer 类负责绘制控件,他是一个有虚方法的公共类,派生类可以修改显示大小和列标题或者重绘控件的任何部分。




贴图图片

Here is the renderer that produces this appearance:

public class DemoRenderer : ImageListView.ImageListViewRenderer
{
   // Returns item size for the given view mode.
   public override Size MeasureItem(View view)
   {
      if (view == View.Thumbnails)
      {
         Size itemPadding = new Size(4, 4);
         Size sz = ImageListView.ThumbnailSize + ImageListView.ItemMargin +
         itemPadding + itemPadding;
         return sz;
      }
      else
      return base.MeasureItem(view);
   }
   // Draws the background of the control.
   public override void DrawBackground(Graphics g, Rectangle bounds)
   {
      if (ImageListView.View == View.Thumbnails)
      g.Clear(Color.FromArgb(32, 32, 32));
      else
      base.DrawBackground(g, bounds);
   }
   // Draws the specified item on the given graphics.
   public override void DrawItem(Graphics g,
   ImageListViewItem item, ItemState state)
   {
      if (ImageListView.View == View.Thumbnails)
      {
         Rectangle bounds = item.Bounds;
         // Black background
         using (Brush b = new SolidBrush(Color.Black))
         {
            g.FillRoundedRectangle(b, bounds, 4);
         }
         // Background of selected items
         if ((state & ItemState.Selected) == ItemState.Selected)
         {
            using (Brush b = new SolidBrush(Color.FromArgb(128,
            SystemColors.Highlight)))
            {
               g.FillRoundedRectangle(b, bounds, 4);
            }
         }
         // Gradient background
         using (Brush b = new LinearGradientBrush(
         item.Bounds,
         Color.Transparent,
         Color.FromArgb(96, SystemColors.Highlight),
         LinearGradientMode.Vertical))
         {
            g.FillRoundedRectangle(b, bounds, 4);
         }
         // Light overlay for hovered items
         if ((state & ItemState.Hovered) == ItemState.Hovered)
         {
            using (Brush b =
            new SolidBrush(Color.FromArgb(32, SystemColors.Highlight)))
            {
               g.FillRoundedRectangle(b, bounds, 4);
            }
         }
         // Border
         using (Pen p = new Pen(SystemColors.Highlight))
         {
            g.DrawRoundedRectangle(p, bounds.X, bounds.Y, bounds.Width - 1,
            bounds.Height - 1, 4);
         }
         // Image
         Image img = item.ThumbnailImage;
         if (img != null)
         {
            int x = bounds.Left + (bounds.Width - img.Width) / 2;
            int y = bounds.Top + (bounds.Height - img.Height) / 2;
            g.DrawImageUnscaled(item.ThumbnailImage, x, y);
            // Image border
            using (Pen p = new Pen(SystemColors.Highlight))
            {
               g.DrawRectangle(p, x, y, img.Width - 1, img.Height - 1);
            }
         }
      }
      else
      base.DrawItem(g, item, state);
   }
   // Draws the selection rectangle.
   public override void DrawSelectionRectangle(Graphics g, Rectangle selection)
   {
      using (Brush b = new HatchBrush(
      HatchStyle.DarkDownwardDiagonal,
      Color.FromArgb(128, Color.Black),
      Color.FromArgb(128, SystemColors.Highlight)))
      {
         g.FillRectangle(b, selection);
      }
      using (Pen p = new Pen(SystemColors.Highlight))
      {
         g.DrawRectangle(p, selection.X, selection.Y,
         selection.Width, selection.Height);
      }
   }
}

 

Once you write your own renderer, you need to assign it to the ImageListView.


imageListView1.SetRenderer(new DemoRenderer());



原文:
http://www.codeproject.com/KB/list/imagelistview.aspx

www.CSFramework.com 翻译



版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
C/S框架网
上一篇:[原创]超牛Outlook导航导控件(Outlook Navigation Panel)
下一篇:C#实现SQL查询分析器(C# Visual SQL Query Designer)
评论列表

发表评论

评论内容
昵称:
关联文章

C# ImageListView下载(源代码)
ExRichTextEdit 下载
C# Barcode条码使用方法
C#.Net自定义 - GridPopupContainerLookup
C#.Net自定义 - GridPopupContainerEdit
C# 实现完整功能的截图(1)-实现绘图工具栏
使用Scheduler实现生产进度监控程序
ucWindowTitle用户 - 用户界面规范
C#实现DevExpress换肤功能
C#在PictureBox上绘制透明背景文字.
C#.Net用户自定义制作教程
JS日期
C# Winform中如何获取父窗体中的信息
(C#)RichTextBox查找文本演示(功能全)
[原创]C#键盘勾子(Hook),屏蔽键盘活动.(源代码下载)
.NET RichTextBox使用详解
C# Winform动态设置的值及反射技术应用
C#.Net自定义设置图标ToolboxBitmap的用法
C#开发自定义-设置显示工具箱中的图标
Winform C/S框架 - FastReport.NET组下载

热门标签
软件著作权登记证书 .NET .NET Reactor .NET5 .NET6 .NET7 .NET8 .NET9 .NETFramework AI编程 APP AspNetCore AuthV3 Auth-软件授权注册系统 Axios B/S B/S开发框架 B/S框架 BSFramework Bug Bug记录 C#加密解密 C#源码 C/S CHATGPT CMS系统 CodeGenerator CSFramework.DB CSFramework.EF CSFramework.License CSFrameworkV1学习版 CSFrameworkV2标准版 CSFrameworkV3高级版 CSFrameworkV4企业版 CSFrameworkV5旗舰版 CSFrameworkV6.0 CSFrameworkV6.1 CSFrameworkV6旗舰版 DAL数据访问层 DaMeng Database datalock DbFramework DeepSeek Demo教学 Demo实例 Demo下载 DevExpress教程 Docker Desktop DOM ECS服务器 EFCore EF框架 Element-UI EntityFramework ERP ES6 Excel FastReport GIT HR HR考勤系统 IDatabase IIS JavaScript LinERP LINQ MES MiniFramework MIS MSSQL MySql NavBarControl NETCore Node.JS NPM OMS Oracle资料 ORM PaaS POS PostgreSql Promise API PSD QMS RedGet Redis RSA SAP Schema SEO SEO文章 SQL SQLConnector SQLite SqlServer Swagger TMS系统 Token令牌 VS2022 VSCode VS升级 VUE WCF WebApi WebApi NETCore WebApi框架 WEB开发框架 Windows服务 Winform 开发框架 Winform 开发平台 WinFramework Workflow工作流 Workflow流程引擎 XtraReport 安装环境 版本区别 报表 备份还原 踩坑日记 操作手册 成本核算系统 达梦数据库 代码生成器 电子线材ERP 迭代开发记录 功能介绍 官方软件下载 国际化 海康威视考勤 基础资料窗体 架构设计 角色权限 开发sce 开发工具 开发技巧 开发教程 开发框架 开发平台 开发指南 客户案例 快速搭站系统 快速开发平台 框架升级 毛衫行业ERP 秘钥 密钥 企业网络维护 权限设计 软件报价 软件测试报告 软件加壳 软件简介 软件开发框架 软件开发平台 软件开发文档 软件授权 软件授权注册系统 软件体系架构 软件下载 软件著作权登记证书 软著证书 三层架构 设计模式 生成代码 实用小技巧 视频下载 收钱音箱 数据锁 数据同步 塑木地板行业ERP 推荐软件 微信小程序 未解决问题 文档下载 喜鹊ERP 喜鹊软件 系统对接 线联ERP 详细设计说明书 新功能 信创 行政区域数据库 需求分析 疑难杂症 蝇量级框架 蝇量框架 用户管理 用户开发手册 用户控件 在线软件 在线支付 纸箱ERP 智能语音收款机 自定义窗体 自定义组件 自动升级程序
联系我们
联系电话:13923396219(微信同号)
电子邮箱:23404761@qq.com
站长微信二维码
微信二维码