Пример #1
0
        public MainForm()
        {
            InitializeComponent();
            Listening_FLag = false;
            pflag          = false;
            Program.fhc.SetForm("MainForm", "Compare_Text", "Eculid_Text", "DotMult_Text", "LeapStatus");
            //test
            p = new Process();
            string path = Path.GetFullPath(".\\") + "demo1.exe ";

            p.StartInfo.FileName        = @path;
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.WindowStyle     = System.Diagnostics.ProcessWindowStyle.Maximized;//加上这句效果更好
            BeforeResize = this.Size;
            foreach (Control c in this.Controls)
            {
                Point p = new Point(c.Left, c.Top);
                BasicDic.Add(c.Name, p);
            }
            Point p_size = new Point(this.Exe_Panel.Size.Width, this.Exe_Panel.Size.Height);

            BasicDic.Add(this.Exe_Panel.Name + "Size", p_size);
            //\end test
            Hand_Description = new TextBox();

            Hand_Description.ReadOnly = false;
            Hand_Description.Visible  = true;
            this.Controls.Add(Hand_Description);
        }
Пример #2
0
        private void MainForm_Resize(object sender, EventArgs e)
        {
            System.Drawing.Size EndResize = this.Size;
            float widthpara  = (float)EndResize.Width / (float)BeforeResize.Width;
            float heightpara = (float)EndResize.Height / (float)BeforeResize.Height;

            foreach (Control c in this.Controls)
            {
                Point tmp;
                BasicDic.TryGetValue(c.Name, out tmp);
                c.Top  = (int)(heightpara * (float)tmp.Y);
                c.Left = (int)(widthpara * (float)tmp.X);
            }
            Point p_size;

            BasicDic.TryGetValue(this.Exe_Panel.Name + "Size", out p_size);
            this.Exe_Panel.Width  = (int)(widthpara * (float)p_size.X);
            this.Exe_Panel.Height = (int)(heightpara * (float)p_size.Y);
            if (pflag)
            {
                ShowWindow(p.MainWindowHandle, 9);
                ShowWindow(p.MainWindowHandle, 3);
            }
        }