Position

Hi,

I have set the Window Full Screen value as “True” in open event. In Window I have one rectangle . I want to place the rectangle in center of the Window.

In Window open event I have retrieve the Window positions (Left 0 , Top 0 , Width 1280 , Height 1024)

You’ll need to do a little math to calculate the window’s center:

You take the width of your rectangle and subtract it from the window’s width and divide that result by two. That gives you the x position for where you draw the rectangle. Do the same with the height for the y coordinate.

You might be better off to put this code in the window’s resize event, as if you only put in the open event the rectangle position won’t change if the user resizes the window.

Let say i have a rectangle and i want it on middle of window

Oval1.Left =(self.Width-Oval1.Width)/2 Oval1.Top =(self.Height -Oval1.Height)/2