|
-
September 25th, 2004, 06:07 AM
#1
DrawText Problem Figuring Out the Size of a Radio Button
I've been messing around with this for several days. It appears that DrawText with the DT_CALCRECT does not calculate the rectangle right for a Radio or Checkbox button.
I created a simple project and placed a Radio and Checkbox button on a blank form view and did some experimenting. If I place the button with no text in it at all, do a GetWindowRect on the control, read the string from the control and do DrawText with DT_CALCRECT, the rectangle returned will be exactly the same size as it was before calling DrawText. I suppose that's because the function failed. In any case, the return is zero.
If I create a string to to go in the control, or have default text I read from the control, the rectangle gets resized by DrawText, but the new size is only big enough for the text, it is not big enough for the text and the check box or radio circle of the control.
How do I either calculate the size needed for the entire control with the check or radio button with the text? In my application, I am changing the text in radio buttons frequently. Sometimes the text is only a partial line and other times it is multiple lines, so I need to resize the control dynamically. To do that, I need an accurate calculation of the size!
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
|