• C#实现控件随窗体拖动而自动缩放其大小


    C#代码:

      public  void AutoScale(Form frm)
            {
                frm.Tag = frm.Width.ToString() + "," + frm.Height.ToString();
                frm.SizeChanged += new EventHandler(frmScreen_SizeChanged);
            }

            private void frmScreen_SizeChanged(object sender, EventArgs e)
            {
                string[] tmp = ((Form)sender).Tag.ToString().Split(',');
                float width = (float)((Form)sender).Width / (float)Convert.ToInt16(tmp[0]);
                float heigth = (float)((Form)sender).Height / (float)Convert.ToInt16(tmp[1]);

                ((Form)sender).Tag = ((Form)sender).Width.ToString() + "," + ((Form)sender).Height;

                foreach (Control control in ((Form)sender).Controls)
                {
                    control.Scale(new SizeF(width, heigth));

                }
            }

           public frmScreen()
            {
                InitializeComponent();

                         AutoScale(this);
            }

  • 相关阅读:
    双六游戏 扩展欧几里得
    线段上的格点 辗转相除法(GCD)
    POJ 2395 Out of Hay
    POJ 2377 Bad Cowtractors
    POJ 1258 Agri-Net
    POJ 3169 Layout
    POJ 3723 Conscription
    次最短路径 POJ 3255 Roadblocks
    最小生成树求法 Prim + Kruskal
    如何将页脚固定在页面底部,4中方法 转载自:W3CPLUS
  • 原文地址:https://www.cnblogs.com/yuxuan/p/1834448.html
Copyright © 2020-2023  润新知