Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restrict Form within Excel application bounds

Status
Not open for further replies.

raydenl

Programmer
Sep 22, 2003
22
NZ

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top