示例#1
0
        private void Form2_Load(object sender, EventArgs e)
        {
            fc = new FormControl(this);
            fc.GetInit(this, fc);

            this.formStartX = this.Width;
            this.formStartY = this.Height;
        }
示例#2
0
        /// <summary>
        /// 记录所有初始值
        /// </summary>
        /// <param name="cons"></param>
        /// <param name="paraent"></param>
        public void GetInit(Control cons, FormControl paraent)
        {
            if (cons.Controls.Count > 0)
            {
                foreach (Control con in cons.Controls)
                {
                    con.Anchor = AnchorStyles.Left | AnchorStyles.Top;

                    FormControl fc = new FormControl(con);

                    fc.GetInit(con, fc);
                    paraent.Child.Add(fc);
                }
            }
            else
            {
                return;
            }
        }
示例#3
0
        /// <summary>
        /// 回到初始状态
        /// </summary>
        /// <param name="cons"></param>
        public void Reset(Control cons, FormControl fcs)
        {
            if (cons.Controls.Count > 0)
            {
                foreach (Control con in cons.Controls)
                {
                    foreach (FormControl fc in fcs.Child)
                    {
                        if (fc.ControlName == con.Name)
                        {
                            con.Left   = fc.InitLeft;
                            con.Top    = fc.InitTop;
                            con.Width  = fc.Width;
                            con.Height = fc.Height;

                            Single currentSize = Convert.ToSingle(fc.InitFontSize);
                            con.Font = new Font(con.Font.Name, currentSize, con.Font.Style, con.Font.Unit);

                            fc.Reset(con, fc);
                        }
                    }
                }
            }
        }