自绘ListBox的两种效果
2008-04-10 02:56:51来源:互联网 阅读 ()
本文利用Listbox自绘实现了两种特殊效果,其中第两种风格来自C Builder 研究 www.ccrun.com,老妖用BCB实现了,现在把它转换成Delphi代码。
演示图片:
//--------------------------------------------------------------------------
unit DrawListItem;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ImgList, jpeg, ExtCtrls;
type
TForm1 = class(TForm)
lsbRight: TListBox;
ImageList1: TImageList;
StaticText1: TStaticText;
lsbLeft: TListBox;
imgHouse: TImage;
imgHouseGray: TImage;
procedure FormCreate(Sender: TObject);
procedure lsbRightDrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
procedure lsbRightClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure lsbLeftDrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
private
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{========================================================================
DESIGN BY : 彭国辉
DATE: 2004-11-29
SITE: http://kacarton.yeah.net/
BLOG: http://blog.csdn.net/nhconch
EMAIL: kacarton@sohu.com
文章为作者原创,转载前请先与本人联系,转载请注明文章出处、保留作者信息,谢谢支持!
=========================================================================}
procedure TForm1.FormCreate(Sender: TObject);
var
i: integer;
begin
lsbRight.Style := lbOwnerDrawFixed;
lsbRight.Ctl3D := false;
lsbRight.ItemHeight := 50;
lsbRight.Items.Add(''''C Builder 研究 www.ccrun.com''''#13''''致力于BCB的学习探讨和研究''''#13''''ccrun(老妖)'''');
lsbRight.Items.Add(''''编程手札 My Developer Knowledge Base''''#13''''http://blog.csdn.net/nhconch''''#13''''天蝎蝴蝶'''');
for i:=3 to 10 do begin
lsbRight.Items.Add(''''ListBox Items of '''' IntTostr(i) #13''''Second of ''''
IntToStr(i) #13''''Third of '''' IntToStr(i));
end;
lsbLeft.Style := lbOwnerDrawFixed;
lsbLeft.Ctl3D := false;
lsbLeft.ItemHeight := 90;
lsbLeft.Items.Add(''''编程手札'''');
lsbLeft.Items.Add(''''My Developer Knowledge Base'''');
lsbLeft.Items.Add(''''站长:天蝎蝴蝶'''');
lsbLeft.Items.Add(''''http://blog.csdn.net/nhconch'''');
end;
procedure TForm1.lsbRightDrawItem(Control: TWinControl; Index: Integer;
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
Rect: TRect; State: TOwnerDrawState);
var
strTemp: String;
begin
//文字颜色
lsbRight.Canvas.Font.Color := clBlack;
//设置背景颜色并填充背景
lsbRight.Canvas.Brush.Color := clWhite;
lsbRight.Canvas.FillRect (Rect);
//设置圆角矩形颜色并画出圆角矩形
lsbRight.Canvas.Brush.Color := TColor($00FFF7F7);
lsbRight.Canvas.Pen.Color := TColor($00131315);
lsbRight.Canvas.RoundRect(Rect.Left
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash