| Autor |
Beitrag |
FriFra
      
Beiträge: 557
Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
|
Verfasst: Do 29.05.03 11:49
Div. VCL Komponenten verwenden ja Checkboxen und zeigen diese dann so an, wie es am System "üblich" ist (unterschiede Win9x, XP...).
Woher "wissen" diese Komponenten, wie sie eine Checkbox korrekt zu zeichnen haben? Es muss doch irgendwo eine Art Systemimages Checkbox-Unchecked, -Checked geben?
Ich will diese CheckBox-Images in eine ImageList laden, um diese dann als Statusimages in einer Listview zu verwenden. Die Eigenschaft "CheckBoxes" einer Listview verhindert ja leider die Anzeige von SubitemImages, so dass ich Checkboxen nur über Statusimages darstellen kann. Allerdings sehen meine Checkboxen jetzt immer so aus wie unter Win9x, da ich statische Images dafür verwende.
_________________ Michael
(principal certified lotus professional - developer)
Zuletzt bearbeitet von FriFra am Do 29.05.03 15:39, insgesamt 1-mal bearbeitet
|
|
Motzi
      
Beiträge: 2931
XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
|
Verfasst: Do 29.05.03 12:01
Schau dir mal die API-Funktion DrawFrameControl an...
_________________ gringo pussy cats - eef i see you i will pull your tail out by eets roots!
|
|
FriFra 
      
Beiträge: 557
Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
|
Verfasst: Do 29.05.03 13:30
Danke für den Tip...
Ich habe mir jetzt folgende Funktion gebastelt:
Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28:
| function GetCheckBoxImage(Checked: boolean; BgColor: TColor): TBitmap; const CtrlState: array[Boolean] of Integer = (DFCS_BUTTONCHECK, DFCS_BUTTONCHECK or DFCS_CHECKED); var CBRect: TRect; begin Result := nil; try Result := TBitmap.Create; with Result do begin Width := 16; Height := 16; with Canvas do begin Brush.Color := BgColor; FillRect(ClipRect); CBRect.Left := ClipRect.Left + 2; CBRect.Right := ClipRect.Right - 1; CBRect.Top := ClipRect.Top + 2; CBRect.Bottom := ClipRect.Bottom - 1; DrawFrameControl(Handle, CBRect, DFC_BUTTON, CtrlState[Checked]); end; end; finally end; end; |
Allerdings ignoriert diese Funktion XP-Styles...
Das Linke Image wurde über DrawFrameControl gezeichnet, rechts ist eine "echte" CheckBox
_________________ Michael
(principal certified lotus professional - developer)
|
|
FriFra 
      
Beiträge: 557
Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
|
Verfasst: Do 29.05.03 14:17
Ich habe die Funktion jetzt auch Themes tauglich bekommen
www.delphi-forum.de/viewtopic.php?t=11959
_________________ Michael
(principal certified lotus professional - developer)
|
|
|