Results 1 to 7 of 7

Thread: Check Boxes

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Location
    Orlando, FL
    Posts
    253

    Check Boxes

    I am createing a checkbox that is a child window of a tab control.

    The checkbox is not displaying the text as transparent with the
    tab control. Can anyone tell me how to set the text to
    transparent for the check box?

    I have a pic of the checkbox on the tab control.

    here is the creating code for the check box:

    CreateWindowEx 0, lpClassName, lpWindowName, WS_CHILD Or BS_AUTOCHECKBOX, lpRect.Left, lpRect.Top, 200, lpMetrics.tmHeight + 2, mlngTab, 0, glngApp, 0
    Always looking for a better and faster way!

  2. #2
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    hmm... checkbox's dont have a backstyle property do they

    labels do though

    you could just set the caption property of the checkbox to <blank>

    and have a label instead? then set the backstyle of the label to Transparent.
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Location
    Orlando, FL
    Posts
    253
    I thought of that and just set the static control to owner draw
    and manually dray the text. However, the static control wont be
    associated with the chack box control, so users would have to
    click on the checkbox itself rather then the check box and label
    combined.

    There must be a way to do this. Im assuming its part of the way
    the control styles are set.
    Always looking for a better and faster way!

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    In the click event of the label, call the click event of the checkbox.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Location
    Orlando, FL
    Posts
    253
    Hmmm...that just might work...

    Static>GetFocus And Check>GetFocus
    Draw focus rectangle arround the static control

    Static>Click
    Send a click message to the check box control

    I think that will work...anyone have any other ideas?
    Always looking for a better and faster way!

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Location
    Orlando, FL
    Posts
    253
    OK, i got the transparency to work. I used the idea from you guys and used a label instead. I just need to draw the focus rectangle arround the static control now when the checkbox recieves the focus.

    Here is the new 'Transparent' look:
    Attached Images Attached Images  
    Always looking for a better and faster way!

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Location
    Orlando, FL
    Posts
    253
    YAY! I did it! Thanks for that idea it worked great!

    VB Code:
    1. Case BN_SETFOCUS, BN_KILLFOCUS 'Message
    2.     Select Case lParam 'hWnd
    3.         Case mlngControls(22) 'Check box
    4.             lhWnd = mlngControls(21) 'Check box label
    5.         Case mlngControls(24) 'Check box
    6.             lhWnd = mlngControls(23) 'Check box label
    7.     End Select
    8.    
    9.     'Get the dimansions of the static control
    10.     GetClientRect lhWnd, lpRect
    11.     'Draw the rectangle
    12.     DrawFocusRect GetDC(lhWnd), lpRect

    Check it out! Compare it to the first picture and what a difference! It works great, Thanks.
    Attached Images Attached Images  
    Always looking for a better and faster way!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width