zbatev Posted December 15, 2011 Share Posted December 15, 2011 (edited) Hi, I want to move my forms around. so I'm using WinMove to achieve that, my problem is that I believe the units return by the WinGetPos(pixel) is different from the units used by forms, i'm not sure thought but does it use twips? Is there a way to convert the form's/control's size to pixels? This is what I'm trying to accomplish I want both forms to end up in-lined at the bottom. but my code doesn't do that. ***Please don't mind the GUI management, I'm just trying to show what I want to accomplish, this is not the actual code: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> Global $Form2 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 307, 511) $Label1 = GUICtrlCreateLabel("Move this window around and click the button below", 10, 10, 253, 17) $Button1 = GUICtrlCreateButton("Move the other window beside me aligned at the bottom", 10, 40, 280, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### _SideBySideBottom() While 1 $nMsg = GUIGetMsg(1) Switch $nMsg[1] Case $Form1 Switch $nMsg[0] Case $GUI_EVENT_CLOSE Exit Case $Button1 GUIDelete($Form2) _SideBySideBottom() EndSwitch Case $Form2 Switch $nMsg[0] Case $GUI_EVENT_CLOSE EndSwitch EndSwitch WEnd Func _SideBySideBottom() $Form2 = GUICreate("", 488, 306) GUISetBkColor(0xFFFFFF) $editor = GUICtrlCreateEdit("", 8, 8, 465, 289, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY)) GUICtrlSetBkColor(-1, 0xFFFFFF) GUISetState(@SW_SHOW) $frm1pos = WinGetPos($Form1) $frm2pos = WinGetPos($Form2) WinMove($Form2,"", $frm1pos[0] - $frm2pos[2], $frm1pos[3] - $frm2pos[3] ) EndFunc Edited December 15, 2011 by zbatev Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted December 15, 2011 Share Posted December 15, 2011 It's all pixels, you are just doing the math wrong. Not sure what you want, maybe this? WinMove($Form2,"", $frm1pos[0] - $frm2pos[2], $frm1pos[1] + $frm1pos[3] - $frm2pos[3]) zbatev 1 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
zbatev Posted December 15, 2011 Author Share Posted December 15, 2011 (edited) Hahahahaha... never really put that into account, thanks a lot... really made me realize how I overlooked that. Damn Y-coordinate! Edited December 15, 2011 by zbatev Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now