如何让编写的程序界面自动适应各种大小的彩显如15#,17#和不同分辩率如800*600,1024*768?

解决方案 »

  1.   

    自己在程序中加入判断。如:
    gBox1.Left=20;
    gBox1.Width=frmMain.Width-40;
    if(frmMain.Width>850)
    gBox1.Height=frmMain.Height-130;
    else
    gBox1.Height=frmMain.Height-180;
      

  2.   

    利用控件自己的属性 dock 和 fill
      

  3.   

    用直接获取窗体显示的宽度和高度的方法
    System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height
    System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width
    Size SZ=new Size (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height,System.Windows.Forms.Screen.PrimaryScreen.Bounds.WidthCAT.SHeight);
    this.Size =SZ;