AGB  ·  Datenschutz  ·  Impressum  







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

TListView.OnDrawItem

Ein Thema von WojTec · begonnen am 15. Nov 2010 · letzter Beitrag vom 17. Nov 2010
Antwort Antwort
Seite 3 von 3     123   
Namenloser

Registriert seit: 7. Jun 2006
Ort: Karlsruhe
3.724 Beiträge
 
FreePascal / Lazarus
 
#21

AW: TListView.OnDrawItem

  Alt 17. Nov 2010, 14:42
One thing I immediately spotted:
Delphi-Quellcode:
procedure TForm20.FormCreate(Sender: TObject);
begin
  SetWindowTheme(lvRecentFiles.Handle, 'Explorer', nil);
  Theme := OpenThemeData(0, 'ListView');
end;
has to be
Delphi-Quellcode:
procedure TForm20.FormCreate(Sender: TObject);
begin
  SetWindowTheme(lvRecentFiles.Handle, 'Explorer', nil);
  Theme := OpenThemeData(lvRecentFiles.Handle, 'ListView');
end;
Because, as I said, you have to manually activate the "explorer style" for each window by calling SetWindowTheme. If you do this for a specific window, but then open the theme data of a different window handle (0), of course it won't work.

Not saying, that this is the only issue (might be, might not be), but at least it's one reason why it can't work. If it doesn't work after changing this, try to set DefaultDraw to False because it's possible that the default drawing routine overdraws the background again (I don't know about that and I'm too lazy to look it up in the VCL sources).

Also, I don't know what the difference between OnDrawItem and OnCustomDrawItem is, and in which order they are called. But I would suggest moving the DrawThemedBackground -code to the OnDrawItem routine.

Geändert von Namenloser (17. Nov 2010 um 18:28 Uhr)
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#22

Re: AW: TListView.OnDrawItem

  Alt 17. Nov 2010, 18:07
Now working Thanks so much!

Delphi-Quellcode:
    Brush.Style := bsClear;
    FillRect(Rect);

    if odSelected in State then
    begin
      DrawThemeBackground(Theme, lvRecentFiles.Canvas.Handle,
        LVP_LISTITEM, LIS_SELECTED, Rect, nil
      );
    end;
Yes, OnCustom* are not required, just OnDrawItem is needed. This cod I putten between font color and text render. And now I have list liki in Delphi
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 3 von 3     123   


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 00:52 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