C# ImageListView控件下载(源代码)
ImageListView
By Ozgur OzcitakA .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:
{
// 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快速开发框架 | 源代码命名规范|软件手册
[论坛社区]塞普森论坛交流系统2007源代码 (.Net 1.1)-源码下载
[电子商务]塞普森电子商务系统2007源代码 (.Net 1.1)_cpushecsopen-源码下载
C#源码-[博客空间]X3BLOG(ASP.NET开源多用户博客系统) 1.1.0 beta1 源代码_x3blog-源码下载
C#源码-微信营销系统(第三方微信平台)C#完整源代码-源码下载
C#源代码安全缺陷与提高源代码质量解决方案-WCF服务配置安全
C#源代码安全缺陷与提高源代码质量解决方案
CSFramework C#代码生成器生成窗体界面UI,BLL,DAL,Model,WCF接口层源代码
软件开发与设计 - BBS-电子布告栏系统-塞普森论坛交流系统2007源代码 (.Net 1.1)
原创:CodeHighlighter源代码格式化,代码缩进,关键词高亮着色(C#源码)
CS开发框架如何做到源代码的保密和不被第三方窃取呢?
开发框架提供全部源代码 都包括啥?
ExRichTextEdit 控件下载
Asp.Net三层体系结构应用实例(附C#源代码)
[原创] Asp.Net三层体系结构应用实例(2)源代码
最全C#OOP面向对象程序设计源代码(Car.cs)
什么是C/S结构? | C/S框架核心组成部分 | C/S框架-WebService部署图 | C/S框架-权限管理 | C/S结构系统框架 - 5.1旗舰版介绍 | C/S结构系统框架 - 功能介绍 | C/S结构系统框架 - 产品列表 | C/S结构系统框架 - 应用展示(图) | 三层体系架构详解 | C/S架构轻量级快速开发框架 | C/S框架网客户案例 | WebApi快速开发框架 | C/S框架代码生成器 | 用户授权注册软件系统 | 版本自动升级软件 | 数据库底层应用框架 | CSFramework.CMS内容管理系统 |
在线客服
