Registriert seit: 27. Apr 2005
Ort: Görlitz
1.358 Beiträge
Delphi XE2 Professional
|
Re: VirtualStringTree (VST) und Progressbar einbinden
27. Apr 2009, 08:27
Das einfachste ist eine selbstgeschriebene OnAfterCellPaint à la:
Delphi-Quellcode:
var
NData : PNodeData;
PBRect : TRect;
Text : String;
begin
if Column = 1 then
begin
if GetNodeData(Node, NData) then
begin
PBRect := Rect(CellRect.Left + 1,
CellRect.Top + 1,
CellRect.Left + Round((CellRect.Right - CellRect.Left - 2) * (NData.Percent / 100)),
CellRect.Bottom - 1);
with TargetCanvas do
begin
Pen.Color := RGB(226, 194, 95);
Pen.Style := psSolid;
Brush.Style := bsClear;
Rectangle(PBRect);
Brush.Color := RGB(246, 224, 123);
Brush.Style := bsSolid;
FillRect(Rect(PBRect.Left + 2,
PBRect.Top + 2,
PBRect.Right - 2,
PBRect.Bottom - 2));
Text := Format(' %d %%', [NData.Percent]);
Font.Color := clBlack;
Brush.Style := bsClear;
TextOut(CellRect.Left + ((CellRect.Right - CellRect.Left) div 2) - (TextWidth(Text) div 2),
CellRect.Top + ((CellRect.Bottom - CellRect.Top) div 2) - (TextHeight(Text) div 2),
Text);
end;
end;
end;
end;
Benjamin Schwarze If I have seen further it is by standing on the shoulders of Giants. (Isaac Newton)
|
|
Zitat
|