I am trying to popup a SizableToolWindow (Notification.cs) within an Excel application, but constrain it to within the bounds of the Excel application... at the present the form can be moved outside of the application.
This is what I have:
Code:
private void ThisWorkbook_Startup(object sender, System.EventArgs e)
{
Notification notification = new Notification();
NativeWindow xlWindow = new NativeWindow();
xlWindow.AssignHandle(new IntPtr(this.Application.Hwnd));
notification.Show(xlWindow);
xlWindow.ReleaseHandle();
}
This does half of what I want, in that it keeps the notification window on top of this Excel application, but the notification window can still be moved outside of the main Excel app.
I have seen a .NET Excel application (no access to source code) that does this so I know it's possible, but I can't work out how to do it.
I have tried setting the .MdiParent property of the notification window, but haven't worked out how to do it, or if it would work.
Cheers