800*600 dll -->1024*768,dialog nleft,ntop not same
Posted: Mon Jul 10, 2006 6:55 am
Hi,
dialog for 800*600 resource in dll
STO01 DIALOG 0, 0, 400, 290
STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
CAPTION "purin1"
FONT 12, "System"
{
LTEXT "", 106, 113, 58, 106, 10
EDITTEXT 102, 51, 44, 58, 12, WS_BORDER | WS_TABSTOP
CONTROL "", 201, "txbrowse", 0 | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP, 5, 89, 388, 176
}
On 800*600, dialog lays on 0,0 pixel postion and full screen paint, but on 1024*768, it lays at about 40(ntop),5(nleft) pixel postion.
For we want through codes as below to auto fit difrent resolution.
rsl0:=getsysmetrics(0)/800
rsl1:=getsysmetrics(1)/600
for i:=1 TO LEN(::acontrols)
oCtrol = ::aControls
aRect = GetCoors( oCtrol:hWnd )
oCtrol:Move( aRect[1]*rsl0, aRect[2]*rsl1, (aRect[4] - aRect[2])*rsl0, (aRect[3] - aRect[1])*rsl1, .t. )
next
// aRect = GetWndRect( ::hWnd )
MoveWindow( ::hWnd, ::nTop*rsl1, ::nLeft*rsl0, ::nWidth*rsl0, ::nHeight*rsl1, .t. )
Best regard!
Shuming Wang
dialog for 800*600 resource in dll
STO01 DIALOG 0, 0, 400, 290
STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
CAPTION "purin1"
FONT 12, "System"
{
LTEXT "", 106, 113, 58, 106, 10
EDITTEXT 102, 51, 44, 58, 12, WS_BORDER | WS_TABSTOP
CONTROL "", 201, "txbrowse", 0 | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP, 5, 89, 388, 176
}
On 800*600, dialog lays on 0,0 pixel postion and full screen paint, but on 1024*768, it lays at about 40(ntop),5(nleft) pixel postion.
For we want through codes as below to auto fit difrent resolution.
rsl0:=getsysmetrics(0)/800
rsl1:=getsysmetrics(1)/600
for i:=1 TO LEN(::acontrols)
oCtrol = ::aControls
aRect = GetCoors( oCtrol:hWnd )
oCtrol:Move( aRect[1]*rsl0, aRect[2]*rsl1, (aRect[4] - aRect[2])*rsl0, (aRect[3] - aRect[1])*rsl1, .t. )
next
// aRect = GetWndRect( ::hWnd )
MoveWindow( ::hWnd, ::nTop*rsl1, ::nLeft*rsl0, ::nWidth*rsl0, ::nHeight*rsl1, .t. )
Best regard!
Shuming Wang