日期:2014-05-17  浏览次数:20956 次

WINFORM 自己写的全屏事件 有办法避免全屏的过程中窗体闪烁吗?
首先相关代码:

        private void control_magnify(double fw, double fh)//按长宽比例变动调整控件位置 放大用
        {
            int x;
            int y;
            x = Convert.ToInt32(panel1.Size.Width * fw);
            panel1.Size = new Size(x, panel1.Size.Height);
            //x = Convert.ToInt32(panel2.Location.X * fw);
            //y = Convert.ToInt32(panel2.Location.Y * fh);
            //panel2.Location = new Point(x, y);
            x = Convert.ToInt32(panel2.Size.Width * fw);
            y = Convert.ToInt32(panel2.Size.Height * fh);
            panel2.Size = new Size(x, y);
            //x = Convert.ToInt32(panel3.Location.X * fw);
            //y = Convert.ToInt32(panel3.Location.Y * fh);
            //panel3.Location = new Point(x, y);
            x = Convert.ToInt32(panel3.Size.Width * fw);
            y = Convert.ToInt32(panel3.Size.Height * fh);
            panel3.Size = new Size(x, y);
            
            foreach (Control ctl in this.Controls)
            {
                x = Convert.ToInt32(ctl.Location.X * fw);
                y = Convert.ToInt32(ctl.Location.Y * fh);
                ctl.Location = new Point(x, y);
            }
            foreach (Control ctl in this.panel2.Controls)
            {
                if (ctl is PictureBox)
                {
                    x = Convert.ToInt32(ctl.Location.X * fw);