Hi -
I am writing a WIN32 app in CVF - This code need to run at 2 sites. at one the user likes a low screen resolution (1024 x 768), I like 1280 x 1024. The App uses a dialog box to run in. What is the easiest way to get near full screen for both screen settings??
Somehow scale every thing?
Use the Resource Editor to create 2 dialog boxes and use the best fit,( how do you find the default res?)
Something else??
Thanks
Bill
I am writing a WIN32 app in CVF - This code need to run at 2 sites. at one the user likes a low screen resolution (1024 x 768), I like 1280 x 1024. The App uses a dialog box to run in. What is the easiest way to get near full screen for both screen settings??
Somehow scale every thing?
Use the Resource Editor to create 2 dialog boxes and use the best fit,( how do you find the default res?)
Something else??
Thanks
Bill
链接已复制
2 回复数
Well, there isn't a perfect solution -- the stuff is not intended to be used like that; I mean, it is assumed that people use higher resolutions in order to have more space on the screen, not to be able to see the same windows bigger. (Although large/small font settings are taken into account automagically). So, "standard" solution is to size the dialog to fit smaller screens.
Either solution you proposed could work (scale every thing or use 2 dialogs -- the latter is probably nicer but tedious and hard to maintain). I don't 100% understand "how do you find the default res" -- you can get the current res via GetSystemMetrics, and you know what's the default (development) res, don't you?
Here's a relatively simple solution how you could do auto-sizing; I don't guarantee that it will be perfectly nice, but try it yourself. Here we go (untested):
HTH
Jugoslav
Either solution you proposed could work (scale every thing or use 2 dialogs -- the latter is probably nicer but tedious and hard to maintain). I don't 100% understand "how do you find the default res" -- you can get the current res via GetSystemMetrics, and you know what's the default (development) res, don't you?
Here's a relatively simple solution how you could do auto-sizing; I don't guarantee that it will be perfectly nice, but try it yourself. Here we go (untested):
!Interface to EnumProc here CASE(WM_INITDIALOG) iX = GetSystemMetrics(SM_CXSCREEN) iY = GetSystemMetrics(SM_CYSCREEN) IF (iX /= MyFaforiteXRes) & i = EnumChildWindows(hDlg, LOC(EnumProc), MAKELPARAM(iX,iY)) ... LOGICAL FUNCTION EnumProc(hWnd, iXY) !DEC$ATTRIBUTES STDCALL:: EnumProc USE DFWIN INTEGER, INTENT(IN):: hWnd, iXY INTEGER, PARAMETER:: MyFavoriteXRes = 1024, MyFavoriteYRes = 768 TYPE(T_RECT):: Rect REAL:: fX, fY fX = LOWORD(iXY)/REAL(MyFavoriteXRes) fY = HIWORD(iXY)/REAL(MyFavoriteYRes) i = GetWindowRect(hWnd, Rect) !The following is not correct syntax but I'm lazy !to type all conversions to POINT now i = ScreenToClient(GetParent(hWnd), Rect) i = MoveWindow(hWnd, NINT(Rect%Left*fX), NINT(Rect%Top*fY), & NINT((Rect%Right-Rect%Left)*fX), NINT((Rect%Bottom-Rect%Top)*fX), & .FALSE.) EnumProc = .TRUE. END FUNCTION EnumProc
HTH
Jugoslav
...oh, another simple solution just struck my mind -- keep 2 dialogs, but you could easily derive one from another if you just copy it and change Font size in dialog properties. (But I don't think you can change it at run-time.)
