AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi VirtualStringTree (VST) und Progressbar einbinden
Thema durchsuchen
Ansicht
Themen-Optionen

VirtualStringTree (VST) und Progressbar einbinden

Ein Thema von MCXSC · begonnen am 26. Apr 2009 · letzter Beitrag vom 28. Apr 2009
Antwort Antwort
MCXSC
(Gast)

n/a Beiträge
 
#1

VirtualStringTree (VST) und Progressbar einbinden

  Alt 26. Apr 2009, 23:19
Hallo,

ich arbeite mit der VirtualStringTree (VST) von M. Lischke und habe nun folgendes Problem:

Und zwar versuche ich derzeit, in einer Zelle eine Art Progressbar einzubauen (siehe Bild). Allerdings scheitern meine Versuche bereits irgendwie im Ansatz. Hat jemand einen kleinen Tipp bzw. ein kleines Tutorial dazu?

Danke,
MCXSC
Miniaturansicht angehängter Grafiken
ridnacs_336.gif  
  Mit Zitat antworten Zitat
Benutzerbild von Mithrandir
Mithrandir
(CodeLib-Manager)

Registriert seit: 27. Nov 2008
Ort: Delmenhorst
2.379 Beiträge
 
#2

Re: VirtualStringTree (VST) und Progressbar einbinden

  Alt 26. Apr 2009, 23:29
Ich kann dir verraten, wie man eine TProgressBar in eine TStatusBar bekommt. Ich vermute mal, dass sich die beiden Lösungsansätze nur im Ereignis unterscheiden, das benutzt wird.
米斯蘭迪爾
"In einer Zeit universellen Betruges wird das Aussprechen der Wahrheit zu einem revolutionären Akt." -- 1984, George Orwell
  Mit Zitat antworten Zitat
Benutzerbild von chaosben
chaosben

Registriert seit: 27. Apr 2005
Ort: Görlitz
1.358 Beiträge
 
Delphi XE2 Professional
 
#3

Re: VirtualStringTree (VST) und Progressbar einbinden

  Alt 27. Apr 2009, 07: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;
Angehängte Dateien
Dateityp: zip demo_134.zip (355,5 KB, 80x aufgerufen)
Benjamin Schwarze
If I have seen further it is by standing on the shoulders of Giants. (Isaac Newton)
  Mit Zitat antworten Zitat
MCXSC
(Gast)

n/a Beiträge
 
#4

Re: VirtualStringTree (VST) und Progressbar einbinden

  Alt 27. Apr 2009, 12:59
Super, vielen Dank!
  Mit Zitat antworten Zitat
MCXSC
(Gast)

n/a Beiträge
 
#5

Re: VirtualStringTree (VST) und Progressbar einbinden

  Alt 27. Apr 2009, 20:49
Eine Frage habe ich dann doch noch:

Und zwar werden die Prozentzahlen bei mir nur in einem sehr hellen grau angezeigt. Eine Idee?

Ich habe auch schon folgendes versucht:

Delphi-Quellcode:
[...]
  Pen.Color := clBlack;
  Brush.Style := bsClear;
[...]
  Mit Zitat antworten Zitat
Benutzerbild von chaosben
chaosben

Registriert seit: 27. Apr 2005
Ort: Görlitz
1.358 Beiträge
 
Delphi XE2 Professional
 
#6

Re: VirtualStringTree (VST) und Progressbar einbinden

  Alt 28. Apr 2009, 05:35
Ja, sorry ... mein Fehler.
Natürlich muss man vor dem TextOut nicht dem Pen sondern dem Font die Farbe zuweisen.

Delphi-Quellcode:
Text := Format('%d %%', [NData.Percent]);
Font.Color := clBlue; //<----- hier
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);
Benjamin Schwarze
If I have seen further it is by standing on the shoulders of Giants. (Isaac Newton)
  Mit Zitat antworten Zitat
MCXSC
(Gast)

n/a Beiträge
 
#7

Re: VirtualStringTree (VST) und Progressbar einbinden

  Alt 28. Apr 2009, 16:43
Hm, hätte ich auch drauf kommen können.^^

Nur was ich merkwürdig finde: So klappt es, aber in deiner Demo hast du eben dieses "Pen.Color" verwendet (eben auch am Ende) und da klappt es auch...
  Mit Zitat antworten Zitat
Benutzerbild von chaosben
chaosben

Registriert seit: 27. Apr 2005
Ort: Görlitz
1.358 Beiträge
 
Delphi XE2 Professional
 
#8

Re: VirtualStringTree (VST) und Progressbar einbinden

  Alt 28. Apr 2009, 19:39
Ja, das es in der Demo klappt ist Zufall.
Benjamin Schwarze
If I have seen further it is by standing on the shoulders of Giants. (Isaac Newton)
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:45 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz