- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have created a dialog box using the following code,
IF (DLGINIT(ID,DLG)) THEN
....
retlog = DlgModal(DLG)
call DlgUninit(DLG)
END IF
How would you change the size of the dialog box?
Because if I run it, when the display is set to 1600x1200 it fits in the window. But I change the window display to 800x600 the dialog box is bigger.
Thanks
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, what would you like the result to be? You can scale the dialog, but that will clip the contents as well. You can resize the controls within, but that will probably clip most of the text within static control.
Here's the sketch of code which scales everything, including controls' font. See API documentation for details.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
JugoslavDujic,
I can scale the dialog. But lets say I run on a machine that has a resolution of 1600x1200 and a machine that has a resolution of 1024x768. The dialog box will be bigger on the the second machine. I don't want to manually scale the dialog box for each machine. I would like some type of code that will change the size of the dialog box dynamically depending on the current display resolution. Is there a way to do this?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here it is, attached. The idea is to use EnumChildWindows to go through every control in the dialog, and pass the information via type(T_SCALE) (you can make it global instead of using lParam). iOrigXRes/iOrigYRes present the resolution where the dialog is developed, i.e. where it looks "best". Try changing these values, or change your screen resolution.
Note, however, that the end result probably cannot be as nice as manually crafted dialog.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I agree with Jugoslav - better to develop a dialog for each resolution and put up the one that fits the machine, after getting screen info. WIth 1600/1024 = 1.5625 and 12 point/8 point = 1.5, maybe develop the 1600*1200 with 12 point font and the 1024*768 with 8-point. Here is code which will find out the work area of the desktop not obscured by task bar and application desk-top toolbars and outputthem a message box :
Code:
use dfwinty ... ... integer*4 ret logical*4 lret character*100 message character*5 screenx, screeny type (T_RECT) monitor lret=SystemParametersInfo(SPI_GETWORKAREA, 0, LOC(monitor), 0 ) write(screenx,'(i5)') monitor.right-monitor.left write(screeny,'(i5)') monitor.bottom-monitor.top message="screenX="//screenx//",screenY="//screeny message=TRIM(ADJUSTL(message))//""C ! put up a message box showing the X and Y screen resolutions ret = MessageBox(NULL, message, "Screen info"C, MB_OK)
Message Edited by anthonyrichards on 09-15-2004 08:30 AM

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page