zoukankan      html  css  js  c++  java
  • winform窗体跟随窗体





           Form2 frm2 = new Form2();
            private void MoveProc()
            {
                frm2.StartPosition = FormStartPosition.CenterParent;
                frm2.Left = this.Left + panel1.Left;
                frm2.Top = this.Top + panel1.Top;
            }

            public Form1()
            {
                InitializeComponent();
               
                 MoveProc();
                this.AddOwnedForm(frm2);
                frm2.Show();
            }
            
            private void Form1_Move(object senderEventArgs e)
            {
                MoveProc();
            }
            private void button1_Click(object senderEventArgs e)
            {
                Form2 frm2 = new Form2();
                frm2.StartPosition = FormStartPosition.CenterParent;
                frm2.ShowDialog();
            }

    条件:
    1. 缩略图显示包含跟随的窗体
    2. 跟随的窗体只在主窗体的最上面
    3. 主窗体能使用ShowDialog()使用其他窗体
    FORM1
    FORM2





    附件列表

    • 相关阅读:
      广告术语及缩写
      run `npm audit fix` to fix them, or `npm audit` for details
      Notes:SVG(2)---各种常见图形
      Notes:SVG(1)
      Notes:indexedDB使用
      Notes: select选择框
      Notes:DOM的事件模拟
      Notes: DOM Range
      Git-Notes
      Javascript一些实用技巧
    • 原文地址:https://www.cnblogs.com/xe2011/p/3761977.html
    Copyright © 2011-2022 走看看