如何消掉LISTBOX的哪个虚线

sunhuiNO1 2002-01-15 06:26:17
我用LISTBOX自画ITEM
当选中一个项目后,由于我在DRAWITEM事件里改变了RECT的位置
导致在FILLRECT后,哪个虚线消失了,不知道如何不画哪个虚线?
...全文
140 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
sunhuiNO1 2002-01-16
  • 打赏
  • 举报
回复
哎,
qiubolecn 2002-01-15
  • 打赏
  • 举报
回复
我也试了一下
就是第一行的那个虚线框好烦人
sunhuiNO1 2002-01-15
  • 打赏
  • 举报
回复
我是在做类似OICQ的哪个样子的LISTBOX,显示ICON当然是没有问题,我是在
LISTBOX里加了一个HEADER,所有所有的ITEM要下移一个HEADER。HEIGHT的高度
导致哪个虚线不能刷新,不只如何修改
qiubolecn 2002-01-15
  • 打赏
  • 举报
回复
是想写一个左边显示ICON的东东?
给你一个我以前写的控件
{*******************************************************}
{ }
{ ListBoximage }
{ }
{ Copyright (c) qiubolecn }
{ 2000-12-10 }
{ }
{*******************************************************}

unit ListBoximage;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ImgList,ExtCtrls;

type
TListBoximage = class(TListBox)
private
FMargin:integer;
FSpace:integer;
Fimage:Timagelist;
{ Private declarations }
protected
procedure DrawItem(Index: Integer; Rect: TRect;
State: TOwnerDrawState); override;
{ Protected declarations }
public
procedure SetImagelist(sender:Timagelist);
procedure SetMargin(co:integer);
procedure SetSpace(co:integer);
{ Public declarations }
published
property Imagelist:Timagelist read Fimage Write SetImageList;
property Margin:integer read FMargin write SetMargin default 0;
property Space:integer read FSpace write SetSpace default 0;
{ Published declarations }
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents('Samples', [TListBoximage]);
end;

{ TListBoximage }

procedure TListBoximage.DrawItem(Index: Integer; Rect: TRect;
State: TOwnerDrawState);
var
rect0,rect1:TRect;
image:Timage;
begin
inherited;
begin
image:=timage.Create(self);
rect0.Top:=rect.Top;
rect0.Left:=rect.Left+FMargin;
rect0.Right:=rect0.left+rect.Bottom-rect0.top;
rect0.Bottom:=rect.Bottom;
rect1.Top:=0;
rect1.Left:=0;
rect1.Bottom:=rect.Bottom-rect.Top;
rect1.Right:=rect1.Bottom;

fimage.GetBitmap(index,image.Picture.Bitmap);
canvas.CopyRect(rect0,image.canvas,rect1);
canvas.TextOut(rect0.right+fspace,rect0.top,items[index]);

image.free;
end;




end;

procedure TListBoximage.SetImagelist(sender: Timagelist);
begin
FImage:=sender;
end;

procedure TListBoximage.SetMargin(co: integer);
begin
FMargin:=co;
end;

procedure TListBoximage.SetSpace(co: integer);
begin
FSpace:=co;
end;

end.

以前写的,好多重复的没用的东西。懒得改,呵呵
sunhuiNO1 2002-01-15
  • 打赏
  • 举报
回复
能回个帖子吗?
sunhuiNO1 2002-01-15
  • 打赏
  • 举报
回复
我在网吧啊,代码
在LISTBOX的DRAWITEM
with listbox.canvas do
begin
rect.top:=rect.top+21;
rect.bottom:=rect.buttom+21;
FillRect(Rect);
imagelist.draw(canvas,rect.left,rect.top,index);
if cacheck in state then
font.color:=clred
else
font.color:=clwindow;
textout(rect.left,rect.top,listbox.item[index]);
end;
这只是大楷的代码,可是总是出了一个难看的虚线
qiubolecn 2002-01-15
  • 打赏
  • 举报
回复
没看懂问题,把代码贴出来看看
sunhuiNO1 2002-01-15
  • 打赏
  • 举报
回复
有知道的吗?

828

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧