also, when centering a control or a dialog relative to the screen, you should also take into account how big the task bar is - if the task bar is large or on an "unusual" position, your app may end up overlapping it which can produce interesting results! you should calculate the centre based on the available desktop area, rather than the screen area.
the systemparametersinfo() api with the %spi_getworkarea flag will give you the true desktop size.
also see http://www.powerbasic.com/support/pb...ead.php?t=1855
------------------
lance
powerbasic support
mailto:[email protected][email protected]</a>
Announcement
Collapse
No announcement yet.
Dialog Pixels To Units
Collapse
X
-
Peter;
The coordinates used for creating controls are "Client" coordinates, not "Screen" coordinates.
To make a label centered in your Dialog, requires knowing the width and height of the client area (inside of Dialog, excluding the Caption Bar, menu and Borders) and then calculating where to center it.
You seem to be using "Screen" coordinates, based on centering to the screen.
------------------
Leave a comment:
-
Dialog Pixels To Units
When I use the following code:
Code:Dim X As Long, Y As Long Dialog Pixels hDlg, GetSystemMetrics(% SM_CXSCREEN) ,GetSystemMetrics(%SM_CYSCREEN) To Units x, y Control Add Label, hDlg, -1, "Test!", X\2-20, Y\2-10, 40, 20
-------------
Kind regards,
Peter.Tags: None
Leave a comment: