简体   繁体   中英

Force 1/3 width window in Windows 10 Tablet Mode

In Tablet Mode, activating my window causes it to get full width, but our software is a utility program that really works with other programs and needs 1/3 to 1/4 width. Can I control how wide the window gets and also force sharing with the last app?

Try to use properties System.Windows.SystemParameters.PrimaryScreenWidth and System.Windows.SystemParameters.PrimaryScreenHeight which gets size Width and Height of display in pixels.

if (System.Windows.SystemParameters.PrimaryScreenWidth < 1500 && 
    System.Windows.SystemParameters.PrimaryScreenHeight < 800)//you should set your own parameters of your Window of Tablet
{                
   Application.Current.MainWindow.Height = Application.Current.MainWindow.Height/3;
   Application.Current.MainWindow.Width = Application.Current.MainWindow.Width/2;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM