|
-
Jan 3rd, 2007, 02:47 AM
#1
[RESOLVED] Movewindow API
MoveWindow Me.hwnd, (Me.Left / Screen.TwipsPerPixelX) - 20, Me.Top / Screen.TwipsPerPixelY, form1.?, form1.?, 1
Parameters
---------
hWnd
Handle to the window.
X
Specifies the new position of the left side of the window.
Y
Specifies the new position of the top of the window.
nWidth
Specifies the new width of the window.
nHeight
Specifies the new height of the window.
bRepaint
my question is for nwidth (4th) argument should i specify form1.scalewidth or form1.width ?
assume i am going to move form1
-
Jan 3rd, 2007, 02:51 AM
#2
Re: Movewindow API
VB Code:
Me.Move 0, 0, Me.Width, Me.Height
-
Jan 3rd, 2007, 03:06 AM
#3
Re: Movewindow API
If its your own window then as Merri used, me.Move is best, but to answer your question anyway... If you use scaleheight and scalewidth it will only include the form part of the window, so it will not include the frame around the window or the top bar, hence you will lose some height and width.
If you need the exact window size then you will need to use the 'GetWindowRect' API (usually used for other windows)
Last edited by Andrew G; Jan 3rd, 2007 at 03:16 AM.
Reason: Thanks Merri :o
-
Jan 3rd, 2007, 03:07 AM
#4
Re: Movewindow API
ScaleWidth and ScaleHeight return the internal portion of the window where controls can be placed, not the actual size of the window. So Width and Height would be what you want to use.
-
Jan 3rd, 2007, 03:13 AM
#5
Re: Movewindow API
 Originally Posted by Merri
ScaleWidth and ScaleHeight return the internal portion of the window where controls can be placed, not the actual size of the window. So Width and Height would be what you want to use.
I'm obviously half asleep today... Just to add a bit more, if your going to use width and height, you will need to divide them by 15 (screen.TwipsPerPixelX and screen.TwipsPerPixelY) to convert twips to pixels
-
Jan 3rd, 2007, 03:20 AM
#6
Re: Movewindow API
Andrew and Marrie.
Thank you and i undestand. i really had a sligh problem with form after moving. it just jump back and forth coz i have used form1.scaleheight & form1.scalewidth.
after changing the above to form1.width & form1.height the problem is solved.
Thank you all.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|