Autor Beitrag
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Sa 24.04.04 10:03 
Der Titel sagt eigentlich schon alles, ich möchte in einer TChecklistbox die Häkchen (oder auch das fehlende Häkchen) durch eigene kleine Bitmaps ersetzen. Ich denke mal, dass ich dafür auf das OnDrawItem Event selber reagieren muss, habe auch schon in den FAQs das für Listboxen ausprobiert, aber das klappt bei Checklistboxen nicht. Ich erhalte da den Fehler "Invalid class typecast". Kann mir da jemand n Stück weiterhelfen?

_________________
We are, we were and will not be.
Aton
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 125

Windows XP
D7 Enterprise
BeitragVerfasst: Sa 24.04.04 10:17 
Hallo du,

das habe ich für StringGrids gemacht: Vielleicht geht es bei CheckListBoxen genauso?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
OnDrawCell:

  if (ACol = 0) and (ARow > 0) then begin
      with CheckBox[ARow] {vielleicht geht hier auch Image ??!!} do begin
        CopyRect(R, Rect);
        R.TopLeft := Form1.ScreenToClient(StringGrid.ClientToScreen(R.TopLeft));
        R.BottomRight := Form1.ScreenToClient(StringGrid.ClientToScreen(R.BottomRight));
        SetBounds(R.Left, R.Top, R.Right-R.Left, R.Bottom-R.Top);
        BringToFront;
      end;


Hilft das??
Gausi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Sa 24.04.04 11:08 
Ne, nicht wirklich. Ich hab es jetzt zwar hinbekommen, aber zufrieden bin ich mit meiner Lösung noch nicht. Ich setze jetzt nämlich über das Häkchen ein Bitmap. Das hat zur Folge, das erst das Häkchen-Kästchen gezeichnet wird, und darüber dann mein Bitmap. Ist natürlich doppelte Arbeit und irgendiwe unschön...

_________________
We are, we were and will not be.