方法一:设置窗体属性
//程序启动路径,与生成程序的exe文件在同一目录下 public String exePath = Application.StartupPath; //定义窗体宽高 int screenWidth = 0; int screenHeight = 0; screenWidth = (int)System.Windows.SystemParameters.PrimaryScreenWidth; screenHeight = (int)System.Windows.SystemParameters.PrimaryScreenHeight;