Positioning the dialog box in the centre of the screen

Posted by ame on Stack Overflow See other posts from Stack Overflow or by ame
Published on 2010-05-27T06:22:41Z Indexed on 2010/05/27 6:51 UTC
Read the original article Hit count: 161

Filed under:
|
|
|

I have a dialog box developed in mfc for a Windows CE device and want it to occupy the entire screen. I used the following code to center my dialog box on the lcd screen of the device: CWnd* pWnd = GetDesktopWindow(); CenterWindow(pWnd);

However, I still get a tiny sliver of space on the left side of the dialog box, resizing the dialog merely makes it overflow on the right side of the LCD while the tiny space on the left remains (I can see the blue of the win CE desktop behind.)

Are there any suggestions to solve this problem? I checked the margin settings for this dialog box in my .rc files and leftmargin and topmargin are both set to 0. I was wondering if I could get the coordinates of the centre of the screen and then place my window one or two points to the left to deal with the current offset. A messy approach I know!

© Stack Overflow or respective owner

Related posts about gui

Related posts about visual-studio-2005