AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Images in VirtualStringTree (VST)

Ein Thema von larsk81 · begonnen am 8. Jun 2009 · letzter Beitrag vom 9. Jun 2009
Antwort Antwort
Benutzerbild von Nighthawk1310
Nighthawk1310

Registriert seit: 22. Feb 2004
Ort: Izmir / Türkei
45 Beiträge
 
Delphi 7 Enterprise
 
#1

Re: Images in VirtualStringTree (VST)

  Alt 8. Jun 2009, 17:59
Hinterlege den ImageIndex für einen Node in Deinen NodeDaten in einer Variable oder mache den
ImageIndex von anderen Variablen in Deinen NodeDaten "abhängig".

Lass dann deine Images im AfterCellPaint des VST zeichnen. Bei der Methode braucht dem VST übrigens
keine Imagelist zugeordnet zu sein.

Bsp:
Delphi-Quellcode:
        //User online
        if (pNodeDataUser.bOnline and (not pNodeDataUser.bPaused)) then
           frmMain.imgMain.Draw(TargetCanvas, CellRect.Left + 4, CellRect.Top + 3, 8);

        //User paused
        if (pNodeDataUser.bOnline and pNodeDataUser.bPaused) then
           frmMain.imgMain.Draw(TargetCanvas, CellRect.Left + 4, CellRect.Top + 3, 9);

        //User sick
        if (pNodeDataUser.bSick and (not pNodeDataUser.bOnline)) then
           frmMain.imgMain.Draw(TargetCanvas, CellRect.Left + 4, CellRect.Top + 3, 26);
        //User holiday

        if (pNodeDataUser.bHoliDay and (not pNodeDataUser.bOnline)) then
            frmMain.imgMain.Draw(TargetCanvas, CellRect.Left + 4, CellRect.Top + 3, 27);
        
        //User idle
        if (pNodeDataUser.bOnline and pNodeDataUser.bIdle) then
           frmMain.imgMain.Draw(TargetCanvas, CellRect.Left + 23, CellRect.Top + 3, 6);
Auf diese Art und Weise kannst du die Images aus eine Imagelist oder aus einem TImage in den VST Zeichnen.
Die Positionsberechnung liegt in dem Fall allerdings bei Dir.


Anbei noch ein Screenshot aus einem meiner Programme.
Die Symbole benutze ich in meinem Beispiel nicht nur als Anzeige, sondern auch als Schaltflächen
Die Abfrage des Klicks erfolgt dabei im MouseUp des VST's:


Delphi-Quellcode:
         //X und Y werden vom VST übergeben
         xNode := vstMainList.GetNodeAt(X, Y);

         if xNode.Dummy = 98 then
            begin
            CellRect := vstMainList.GetDisplayRect(xNode, 0, False);

            //Working/Paused
            if ((X >= CellRect.Left + 2) and (X <= CellRect.Left + 22 )) and
               ((Y >= CellRect.Top + 4) and (Y <= CellRect.Top + 19 )) then
               SetPausedWorking(xNode);

            //CoachingMode
            if ((X >= CellRect.Left + 42) and (X <= CellRect.Left + 60 )) and
               ((Y >= CellRect.Top + 5) and (Y <= CellRect.Top + 19 )) then
               SetCoachingMode(xNode);

            //View
            if ((X >= CellRect.Left + 62) and (X <= CellRect.Left + 80 )) and
               ((Y >= CellRect.Top + 5) and (Y <= CellRect.Top + 19 )) then
               ShowMessage('Nicht implementiert');

            //Talk/Write
            if ((X >= CellRect.Left + 82) and (X <= CellRect.Left + 102 )) and
               ((Y >= CellRect.Top + 5) and (Y <= CellRect.Top + 19 )) then
               ShowMessage('Talk/Write');

            //Refresh
            if ((X >= CellRect.Left + 102) and (X <= CellRect.Left + 120 )) and
               ((Y >= CellRect.Top + 5) and (Y <= CellRect.Top + 19 )) then
               RefreshUser(xNode);
            end;
Je nachdem wie die Variablen in meinen NodeDaten belegt sind lasse ich ein anderes Symbol zeichnen.

Ich hoffe, dass Dir das weiterhilft
Angehängte Grafiken
Dateityp: jpg vst_865.jpg (144,6 KB, 65x aufgerufen)
Michael
  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 12:15 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz