Jan 25th, 2002, 01:35 PM
#1
Thread Starter
Addicted Member
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!
Jan 25th, 2002, 01:43 PM
#2
Bouncy Member
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.
Jan 25th, 2002, 01:49 PM
#3
Thread Starter
Addicted Member
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!
Jan 25th, 2002, 01:53 PM
#4
In the click event of the label, call the click event of the checkbox.
Jan 25th, 2002, 02:01 PM
#5
Thread Starter
Addicted Member
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!
Jan 25th, 2002, 02:51 PM
#6
Thread Starter
Addicted Member
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
Always looking for a better and faster way!
Jan 25th, 2002, 03:38 PM
#7
Thread Starter
Addicted Member
YAY! I did it! Thanks for that idea it worked great!
VB Code:
Case BN_SETFOCUS, BN_KILLFOCUS 'Message
Select Case lParam 'hWnd
Case mlngControls(22) 'Check box
lhWnd = mlngControls(21) 'Check box label
Case mlngControls(24) 'Check box
lhWnd = mlngControls(23) 'Check box label
End Select
'Get the dimansions of the static control
GetClientRect lhWnd, lpRect
'Draw the rectangle
DrawFocusRect GetDC(lhWnd), lpRect
Check it out! Compare it to the first picture and what a difference! It works great, Thanks.
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
Forum Rules
Click Here to Expand Forum to Full Width