this.WindowState = System.Windows.WindowState.Normal;
this.WindowStyle = System.Windows.WindowStyle.None;
this.ResizeMode = System.Windows.ResizeMode.NoResize;
this.Topmost = true;
this.Left = 0.0;
this.Top = 0.0;
this.Width = System.Windows.SystemParameters.PrimaryScreenWidth;
this.Height = System.Windows.SystemParameters.PrimaryScreenHeight;
其中:
WindowState 表明窗口的状态 最大、最小、普通;
WindowStyle 窗口是否存在边框 标题栏等设置;
ResizeMode 窗口是否允许手动缩放;
Left 窗口左侧起点位置;
Top 窗口上侧起点位置;
Width 窗口水平宽度;
Height 窗口垂直高度;
注意: 针对WIN10系统存在一个DPI,即画面的放大参数,在使用扩展屏幕的时候需要格外注意此比例,例如显示器是1920x1080的分辨率,但是电脑中缩放为150%,如果要将窗口完全移出去, left的参数需要为1920➗150%=1280,参考如下:
this.WindowState = System.Windows.WindowState.Normal;
this.WindowStyle = System.Windows.WindowStyle.None;
this.ResizeMode = System.Windows.ResizeMode.NoResize;
this.Topmost = true;
this.Left = 1280;
this.Top = 0.0;
this.Width = System.Windows.SystemParameters.PrimaryScreenWidth;
this.Height = System.Windows.SystemParameters.PrimaryScreenHeight;