WPF中如何获得等比列缩放的窗口
double ScreenWidth; //满屏窗口宽度
double ScreenHeight; //满屏窗口高度
double WindowWidth; //WPF窗口宽度
double WindowHeight; //WPF窗口高度
ScreenWidth = SystemParameters.PrimaryScreenWidth;
ScreenHeight = SystemParameters.PrimaryScreenHeight;
WindowWidth = ScreenWidth/1.5;//这里也可以设置你想要的任何值,如:800
WindowHeight = ScreenHeight*WindowWidth/ScreenWidth;//这个就是根据屏幕的比例自动获得高度
this.width = WindowWidth;
this.height = WindowHeight;
double ScreenHeight; //满屏窗口高度
double WindowWidth; //WPF窗口宽度
double WindowHeight; //WPF窗口高度
ScreenWidth = SystemParameters.PrimaryScreenWidth;
ScreenHeight = SystemParameters.PrimaryScreenHeight;
WindowWidth = ScreenWidth/1.5;//这里也可以设置你想要的任何值,如:800
WindowHeight = ScreenHeight*WindowWidth/ScreenWidth;//这个就是根据屏幕的比例自动获得高度
this.width = WindowWidth;
this.height = WindowHeight;

浙公网安备 33010602011771号