Move event of MDI window is not fired

Docking/MDI for Windows Forms Forum

Posted 4 years ago by Jaruwan Limsukhakorn
Version: 14.1.0321
Avatar
MyToolWindow toolwindow = new MyToolWindow();
toolwindow.DockManager = dockManager1;
toolwindow.State = ToolWindowState.TabbedDocument;
toolwindow.Location = new Point(70, 70);
toolwindow.Activate(true);

 I generate the ToolWindow programmatically like the code above. MyToolWindow is derived from ToolWindow.

 

  public class MyToolWindow : ToolWindow
  {
    public MyToolWindow() : base()
    {
      this.Move         += MyToolWindow_Move;
    }

    private void MyToolWindow_Move(object sender, EventArgs e)
    {
      //do something here.
    }

  }

 I have the move event in the class. The move event is only fired when it is floating or docking window. But if the window is changed to MDI window, and it is moved around via mouse in MDI area, the move event is never fired.

What should I do to make the move event fired?

Comments (4)

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

The Move event is not defined by us, it is part of the core WinForms controls.  As such, we don't raise or fire it.  Off the top of my head, it's probably not firing in a standard MDI scenario since in that case the tool window's content is visible in the MDI window but no tab (which represents the tool window is).


Actipro Software Support

Posted 4 years ago by Jaruwan Limsukhakorn
Avatar

Hello,

OK, I see.

How can I write or access the move event of MDI window in ActiPro? I mean, is it possible to have something like code below?

  public class FormMDI : Form
  {
    public FormMDI() : base ()
    {
      this.Move += FormMDI_Move;
    }

    void FormMDI_Move(object sender, EventArgs e)
    {
      
    }
  }
Answer - Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

If you handle the DockManager.WindowActivated event and you see that the e.TabbedMdiWindow is a document, you could do something like this:

var form = e.TabbedMdiWindow.FindForm();

Then you could attach to the Move event of that Form.  Just be sure that you only do the event tie once per window (keep a flag somewhere for whether you've already done it), and be sure to clear the event tie later on in a WindowClosed event handle.


Actipro Software Support

Posted 4 years ago by Jaruwan Limsukhakorn
Avatar

It works. Thank you for your support :)

[Modified 4 years ago]

The latest build of this product (v2018.1 build 0341) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.