2009/4/11 ??? :
first i wanted to draw a progressbar.i know there is a method of a TListItem
called "DisplayRect",but whatever i do,the rect it returns is (0,0,0,0)
As far as I can see you have found a bug. Please report this in Mantis.
I have tried the following code and the DisplaySubItemRect() is also always (0,0,0,0). The other thing is that I use Sender (TCustomListView type) to retrieve the canvas. If the code below runs, the whole Form is painted Green, whereas at least it should only have been inside the ListView.
I use Lazarus (latest trunk revision) with GTK2 widgetset. Can you try to reproduce this and give feedback?
Steps to reproduce:
-----------------------------
* New LCL application
* Drop TListView on form
* Create 3 new items.
* Create 1 new subitem for each item.
* Add the event handler below
* Run from command line (so writeln() statements work)
===================================
procedure TForm1.ListView1CustomDrawSubItem(Sender: TCustomListView;
Item: TListItem;
SubItem: Integer; State: TCustomDrawState; var DefaultDraw: Boolean);
var
rect: TRect;
begin
writeln('CustomDrawSubItem');
if Item.Caption = 'Item1' then
begin
// if cdsDefault in State then
begin
// DefaultDraw := False;
Rect := Item.DisplayRectSubItem(SubItem, drBounds);
writeln('r.right = ', rect.Right);
Brush.Color := clGreen;
Rect.Right := Trunc(Rect.Right * 0.75); // 75%
Sender.Canvas.FillRect(Rect);
end;
end;
end;
===================================
Show quoted text 17 lines
and whatever i wrote for the drawsubitem/drawitem method it just doesn't
work.
then i tried to put a Tprogressbar under a column,and it failed again.
can anyone help me?
regard,
Yan Chengyuan
--
I'm sure that I will win.
_______________________________________________
Lazarus mailing list
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus