Recent

Author Topic: Checkbox in owner-drawn TCheckListbox  (Read 5881 times)

wp

  • Hero Member
  • *****
  • Posts: 13264
Checkbox in owner-drawn TCheckListbox
« on: July 05, 2011, 09:30:59 pm »
I want to draw a bitmap between the checkbox and the text of a the items of a TCheckListbox. When I activate the lbOwnerDrawFixed style, however, the checkbox gets lost, and I have to redraw it by myself. Looking at the sources of TCheckListbox I cannot find the code which does the drawing of the checkboxes. How is this done? Doing a google search I found code using the ThemeServices. But is this platform-independent?

zeljko

  • Hero Member
  • *****
  • Posts: 1810
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Checkbox in owner-drawn TCheckListbox
« Reply #1 on: July 05, 2011, 09:58:29 pm »
Yes, you should use theme services. I guess that checkbox is implemented for most widgetsets.

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: Checkbox in owner-drawn TCheckListbox
« Reply #2 on: July 06, 2011, 06:50:10 am »
Is there any sense in using TCheckListBox as a base then?
How about TStringGrid -- it is much more flexible.

wp

  • Hero Member
  • *****
  • Posts: 13264
Re: Checkbox in owner-drawn TCheckListbox
« Reply #3 on: July 06, 2011, 08:43:52 am »
Good point. I was thinking about using a TListbox anyway since I do not need the mechanism of storing the check state, but a TStringGrid is maybe even better. I'll have to think about it.

Another question about the ThemeServices: Is it necessary, like in Delphi, to call DrawFrameControl if ThemeServices are not available?

 

TinyPortal © 2005-2018