2
votes

I want to set the window to an exact size for creating a game, since I will use the X and Y coordinates of the screen to move things. The problem is that when setting the window width and height it includes the border in that size, so your actual size is smaller than what you specify. What can I do about this?

3
Can you set the width and height to the panel inside of the window instead? Usually it's a Grid panel unless you have changed it. You can then set your window's SizeToContent property so it can autosize to fit the Grid.failedprogramming
Thanks! It is actually a Canvas, but that worked. Exactly what I was looking for.Emrys90
No worries, that's great!failedprogramming

3 Answers

1
votes

You set the width and height to the panel inside of the window instead. Usually it's a Grid panel unless you have changed it. You can then set your window's SizeToContent property so it can autosize to fit the Grid.

0
votes

Or you could do like this maybe: myForm.Width = yourValue + borderSize;

0
votes

If your window is a WPF window try using AllowsTransparency="True" and WindowStyle="None"