|
From: MFC on 31 Aug 2005 16:15 Dialog resource contains this:- ID DIALOGEX 0, 0, 400, 258 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU FONT 8, "MS Shell Dlg", 400, 0, 0x1 How do I programitically calculate the height and width in pixels of the dialog without any windows API from values 400 and 258? Thanks
From: MFC on 31 Aug 2005 16:22 I can use any windows API as long as that process doesn't involve creation of dialog. "MFC" <MFC(a)nospam.com> wrote in message news:ubLzMjmrFHA.1788(a)tk2msftngp13.phx.gbl... > Dialog resource contains this:- > > ID DIALOGEX 0, 0, 400, 258 > STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU > FONT 8, "MS Shell Dlg", 400, 0, 0x1 > > How do I programitically calculate the height and width in pixels of the > dialog without any windows API from values 400 and 258? > > Thanks > >
From: Priyesh on 31 Aug 2005 16:36 "MFC" <MFC(a)nospam.com> wrote in message news:ubLzMjmrFHA.1788(a)tk2msftngp13.phx.gbl... > Dialog resource contains this:- > > ID DIALOGEX 0, 0, 400, 258 > STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU > FONT 8, "MS Shell Dlg", 400, 0, 0x1 > > How do I programitically calculate the height and width in pixels of the > dialog without any windows API from values 400 and 258? > > Thanks > > This KB article in MSDN seems to explain what you want HOWTO: Calculate Dialog Base Units with Non-System-Based Font
From: MFC on 31 Aug 2005 16:45 used this but width doesn't come properly. LONG l = GetDialogBaseUnits(); WORD baseunitX = LOWORD(l); WORD baseunitY = HIWORD(l); int left = (0 * baseunitX) / 4; int right = (400 * baseunitX) / 4; int top = (0 * baseunitY) / 8; int bottom = (258 * baseunitY) / 8; "Priyesh" <priyesh(a)donotreply.com> wrote in message news:u2CyNumrFHA.2624(a)TK2MSFTNGP15.phx.gbl... > "MFC" <MFC(a)nospam.com> wrote in message > news:ubLzMjmrFHA.1788(a)tk2msftngp13.phx.gbl... > > Dialog resource contains this:- > > > > ID DIALOGEX 0, 0, 400, 258 > > STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU > > FONT 8, "MS Shell Dlg", 400, 0, 0x1 > > > > How do I programitically calculate the height and width in pixels of the > > dialog without any windows API from values 400 and 258? > > > > Thanks > > > > > > This KB article in MSDN seems to explain what you want > > HOWTO: Calculate Dialog Base Units with Non-System-Based Font > >
From: Priyesh on 31 Aug 2005 17:14 "MFC" <MFC(a)nospam.com> wrote in message news:%232aj6zmrFHA.1132(a)TK2MSFTNGP10.phx.gbl... > used this but width doesn't come properly. > LONG l = GetDialogBaseUnits(); > > WORD baseunitX = LOWORD(l); > > WORD baseunitY = HIWORD(l); > > int left = (0 * baseunitX) / 4; > > int right = (400 * baseunitX) / 4; > > int top = (0 * baseunitY) / 8; > > int bottom = (258 * baseunitY) / 8; > > > > "Priyesh" <priyesh(a)donotreply.com> wrote in message > news:u2CyNumrFHA.2624(a)TK2MSFTNGP15.phx.gbl... >> "MFC" <MFC(a)nospam.com> wrote in message >> news:ubLzMjmrFHA.1788(a)tk2msftngp13.phx.gbl... >> > Dialog resource contains this:- >> > >> > ID DIALOGEX 0, 0, 400, 258 >> > STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU >> > FONT 8, "MS Shell Dlg", 400, 0, 0x1 >> > >> > How do I programitically calculate the height and width in pixels of >> > the >> > dialog without any windows API from values 400 and 258? >> > >> > Thanks >> > >> > >> >> This KB article in MSDN seems to explain what you want >> >> HOWTO: Calculate Dialog Base Units with Non-System-Based Font >> >> > > Must be the differences in font width and height in the target dialog template. Try explicitly creating a MS Shell Dlg font (which is the one used by your example template), select it to dc and use GetTextMetrics to find the width and height of the font, then use those as baseunitx and y instead of the ones returned from GetDialogBaseUnits.
|
Pages: 1 Prev: How to change the font in Static Text Next: encrypting a password! |