1

I try to display a window in my application exactly in specified rectangle:

Left = 0, Top = 0, Width = 1920, Height = 240.

It seems to have left and right margin. And a bottom margin. Looks roughly like 8 pixels. Like the system refused to place the window where I told it to by specifying Left, Top, Width and Height properties.

However when I set WindowStyle to None and AllowsTransparency to True- it behaves properly.

But I don't need and I don't want borderless windows, I need normal system windows, but placed correctly. How to achieve it?

If the margins are the part of Windows UI and can't be removed - how to determine their sizes to take into account when placing windows?

I'm testing it with Windows 10 on desktop computer.

Harry
  • 4,524
  • 4
  • 42
  • 81

1 Answers1

2

It's cause there is no design border in windows 10 like windows 7. Use below code to set the Left property:

Left = 0 - SystemParameters.ResizeFrameVerticalBorderWidth - SystemParameters.FixedFrameVerticalBorderWidth;

your window's position will be right after this. Top should be already OK. Set Width equal to SystemParameters.WorkArea.Widththen there should be no margin to Right.

Kylo Ren
  • 8,551
  • 6
  • 41
  • 66
  • I've just tested it, and it works fine, but should this correction be used with Windows 7 too? – Harry Feb 20 '16 at 22:53
  • @Harry Nope. This can't be used with Window 7. If you want your app to run in both OS. you have to put a check of OS before you set the property. – Kylo Ren Feb 20 '16 at 22:58