再1366*768做的系统,在1024*768上运行会变得很难看…超出了屏幕的宽度等问题…
如题…

解决方案 »

  1.   

    发现WPF的程序会自动根据屏幕分辨率调整窗体以及控件的大小
    winform的没搞过这个
    希望高手能够将WPF的实现原理找出来
      

  2.   

    用好 Dock 和 Anchor 属性
      

  3.   

    我们的项目,是动态控制窗体的SIZE 也就是分辨率是多少,它就是多少。不固定。 /// <summary>
            /// 调整窗体大小
            /// </summary>
            private void AutoFormSize()
            {
                // 设置窗体最大化
                this.WindowState = FormWindowState.Maximized;            // 设置其不可以拖动更改大小
                this.MaximumSize = new Size(this.Width, this.Height - 33);
                this.MinimumSize = new Size(this.Width, this.Height - 33);            // 头部
                this.panel_top.Size = new Size(this.panel_Body.Width, this.panel_top.Height);
                this.panel_top.Location = new Point(0, 0);            // 左导航
                this.panel_lbars.Size = new Size(125, (this.panel_Body.Height - this.panel_top.Height - this.panel_bottom.Height) + 2);
                this.panel_lbars.Location = new Point(0, this.panel_top.Height - 2);            // 内容
                this.panel_fitem.Size = new Size((this.panel_Body.Width - this.panel_lbars.Width) + 1, this.panel_lbars.Height - 1);
                this.panel_fitem.Location = new Point(124, this.panel_top.Height - 1);            // 底部
                this.panel_bottom.Size = new Size(this.panel_Body.Width, this.panel_bottom.Height);
                this.panel_bottom.Location = new Point(0, this.panel_Body.Height - this.panel_bottom.Height);            this.panelItemWidth = this.panel_fitem.Width;
            }
      

  4.   


    winform窗体中 控件的Dock 和 Anchor 属性可以使控件布局灵活
      

  5.   

    System.Windows.Forms.SystemInformation.PrimaryMonitorSize.Width就是主显示器的水平分辨率,
    System.Windows.Forms.SystemInformation.PrimaryMonitorSize.Height就是主显示器的垂直分辨率。
    知道了分辨率,自己找个合适的比例设置窗体的高度和宽度吧。
      

  6.   

    可以根据窗体中的Size自动调节控件的大小.
     
    窗体中的Size会根据机器上的分辨率的不同而不同.我都是这样用的.