[Gambas-user] How to open main form in the centre of any screen

Paul Horechuk horechuk at ...981...
Sun Mar 23 15:39:27 CET 2008


On March 23, 2008 10:32:23 am andy2 wrote:
> I have problem to open my software at the centre of my screen. Actually
> i use  the following code:
>
> PUBLIC SUB Main()
>   fMain.x = fMain.ScreenX / 2
>   fMain.y = fMain.ScreenY + 200
>   fMain.Show
> END
>
> But this code doesn't work very well. Thanks for your attention.
>
> Andy
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

How about something like this:

PUBLIC SUB Form_Open()
ME.X = Desktop.Width / 2 - ME.Width / 2
ME.Y = Desktop.Height / 2 - ME.Height / 2

' more code

END
-- 
-- Paul Horechuk
Think Free
Use Open Sourec Software




More information about the User mailing list