c# 界面自适应大小

采用在窗体事件SizeChanged里面代码控制大小和位置,达到自动适应窗体大小,这样做调整起来方便。  

    private void FrmMain_SizeChanged(object sender, EventArgs e)
        {
            //int grpLogWidth = (this.Width * 42) / 100;
            //int tabControlWidth = this.Width - grpLogWidth;

            
            int tabControlWidth = tabControl.Width;
            int grpLogWidth = this.Width - tabControl.Width-50;

            grpLog.Height = this.Height - 100;
            rtxtLog.Height = grpLog.Height - 60;
            grpLog.Width = grpLogWidth;
            rtxtLog.Width = grpLogWidth - 10;

            tabControl.Location = new Point(grpLogWidth + 20, tabControl.Location.Y);
            tabControl.Height = grpLog.Height - 10;
            dgvCalibration.Height = tabControl.Height - 70;            
        }
原文地址:https://www.cnblogs.com/ike_li/p/7340235.html