How to calculate width and height of check box?

How to calculate width and height of check mark of CButton created with BS_CHECKBOX?

I need to resize this button if text not get in client area of button.
If I use simple button I calculate width and height of text by using DrawText with nFormat value DT_CALCRECT, but with button with BS_CHECKBOX flag DrawText not calculating text's width correctly...

Can I calculate width and height of this check mark? Or this value stored in Registry?

If I can't I need to use my own check mark in owner draw button... :-(
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If the check box does not have text (the caption of the button), use the following code.

CRect rect;

int nWidth = rect.Width(), nHeight = rect.Height();
Nicolay_ChAuthor Commented:
I try it two days ago...
But when I create Control I need to set this Rect in Create func...
What for I read this Rect if I setting it?


if (hBmp != NULL)
   BITMAP bmp;
   GetObject(hBmp, sizeof(BITMAP), &bmp);
   printf("%d wide, %d high\n", bmp.bmWidth, bmp.bmHeight);

..B ekiM

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Nicolay_ChAuthor Commented:
Ha-ha-ha... ;-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.