Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Borderless window application takes up more space than my screen resolution

I have created a borderless application in WPF, and it works pretty good. However, when I set the WindowState to full screen, the application takes up more space than my screen resolution, so there are some pixels outside the screen in all directions! (looks like some hard coded negative margins are added to hide the default border)

Any Ideas how to prevent this from happening?

My xaml:

<Window x:Class="MyApp.Shell"
    WindowStyle="None"
    BorderThickness="0"
    AllowsTransparency="True"
    Background="Transparent"
    ResizeMode="CanResizeWithGrip"
    WindowState="{Binding MainApplicationWindowState}"
    ...

Also, another problem I have seen is that the Windows toolbar / taskbar is covered in the fullsize state, so it looks like the "actual" screen height is used and not the "available" screen height, meaning screen height minus the windows toolbar / taskbar!

Anyone found a solution to these issues?

Thanks

like image 643
code-zoop Avatar asked Jan 19 '10 10:01

code-zoop


People also ask

Is windowed borderless better than fullscreen?

Essentially, you get the illusion of fullscreen mode and can still quickly switch to other programs. This is the best alternative to fullscreen mode particularly if you're using more than one monitor. Borderless mode allows you to move your mouse seamlessly from one monitor to another, even when playing computer games.

Is borderless fullscreen or fullscreen faster?

When an application is open in fullscreen mode, Windows grants it full control of the screen's output. Assuming a game is optimized for the system and display being used, fullscreen mode has the potential to boost performance when compared to borderless windowed mode.

Does windowed borderless affect performance?

Theoretically, yes. Most games probably get a performance drop from the setting, but it isn't noticeable or even existent at some point. What borderless windowed mode basically does is keep more background windows in VRAM, so it can expend all of your VRAM if at high enough resolutions.

What resolution is borderless windowed?

Borderless Window can only run at your desktop resolution.


2 Answers

I found this great solution

<Window WindowStyle="None" WindowStartupLocation="CenterScreen" WindowState="Maximized"
        MaxWidth="{Binding Source={x:Static SystemParameters.WorkArea}, Path=Width}"
        MaxHeight="{Binding Source={x:Static SystemParameters.WorkArea}, Path=Height}"
    >
...
</Window>

But error for me still persists, windows is offset by few pixels on top and left... I tried to set Left and Top to 0 after I change window state but nothing happens.

like image 55
Aleksandar Toplek Avatar answered Oct 01 '22 18:10

Aleksandar Toplek


I solved the problem this way:

XAML:

WindowStyle="None"
Left="0"
Top="0"
Width="{Binding WPFSettings.Width}"
Height="{Binding WPFSettings.Height}">

Visual Basic:

Public Class WPFSettings
   Public ReadOnly Property Width() As Double
      Get
         Return System.Windows.SystemParameters.PrimaryScreenWidth
      End Get
   End Property

   Public ReadOnly Property Height() As Double
      Get
         Return System.Windows.SystemParameters.PrimaryScreenHeight
      End Get
   End Property
End Class

It works pretty good.

like image 39
rakete Avatar answered Oct 01 '22 19:10

rakete