| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Hello I'd like to display a form, and when the user clicks on a button, display a second form that will overlay the first one. So I need to read the first form's coordinates (x,y,width,height). I googled the archives of this ng, but didn't find the answer. Does Delphi provide a function for this, or do we need to call a Win32 API? Thank you. |
|
#2
| |||
| |||
| Gilles Ganault wrote: > Hello > > I'd like to display a form, and when the user clicks on a button, > display a second form that will overlay the first one. So I need to > read the first form's coordinates (x,y,width,height). > > I googled the archives of this ng, but didn't find the answer. Does > Delphi provide a function for this, or do we need to call a Win32 API? > > Thank you. Is this a trick question or what? Did you never notice the Top, Left, Width and Height properties of a form? IN fact about every control has these properties. Top and Left are relative to the parent controls client area. For a form with no parent they are relative to the screen. -- Peter Below (TeamB) Don't be a vampire (http://slash7.com/pages/vampires), use the newsgroup archives : http://www.tamaracka.com/search.htm http://groups.google.com |
|
#3
| |||
| |||
| On 5 Aug 2008 03:21:40 -0700, Peter Below (TeamB) wrote: > Is this a trick question or what? Did you never notice the Top, Left, > Width and Height properties of a form? IN fact about every control has > these properties. Top and Left are relative to the parent controls > client area. For a form with no parent they are relative to the screen. Or even simpler. Form2.BoundsRect := Form1.BoundsRect But I would recommend using a single form and create the two alternative views using something like a page control or frames. -- Marc Rohloff [TeamB] marc -at- marc rohloff -dot- com |
|
#4
| |||
| |||
| > Or even simpler. Form2.BoundsRect := Form1.BoundsRect For maximized forms it might be a bit more tricky. IIRC your code works but looks ugly on multi head environments (the border might be visible on another screen). > But I would recommend using a single form and create the two > alternative views using something like a page control or frames. Me, too. However IIRC even Microsoft uses another window with same position and size on top of the main window for the print preview in IE7 :-) -- Jens Gruschel http://www.pegtop.net |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.