Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Maybe this is a question for divil (as he's done a lot Controldevelopment - as far as I know...) but every answer is welcome!

 

I'm working on a Menu-like Contol. I already got most of the designtime support finished. But as I use borderless forms to display the MenuItems I need to know when the user changes to the Codeview or when he minimizes the VisualStudio window - othervise the MenuItems don't get closed and they stay onscreen. Is there a possibility to receive an event when the Designview is hidden or the window is minimized?

 

Thanks!

 

Andreas

  • *Experts*
Posted

If you get the IDesignerHost service of the designer, you can handle its Deactivated event to catch when the designer is deactivated.

 

For example, in the Initialize override of the designer:

Dim dh As IDesignerHost = DirectCast(Me.GetService(GetType(IDesignerHost)), IDesignerHost)

AddHandler dh.Deactivate, AddressOf OnDesignerDeactivate

Then you just need to create your handler routine and you can put any deactivation code in there. Don't forget to unhook the hander in the Finalize override.

Posted

Thanks!

 

...but I already found that... and it doesn't fire when the VisualStudio window is Minimized :( It works when the user switches from the Designview to the Code or another Form etc. but not when VisualStudio is deactivated.....

 

some more suggestions?

 

Andreas

  • *Experts*
Posted
Try making your borderless form owned by the main form. When you create and show it,
MainForm.AddOwnedForm(frm)
'where frm is the instance of your borderless form.

  • *Gurus*
Posted

Can you not just trap the event for when your form loses the focus and hide it?

 

You might be able to do something with IUIService - the IDE implements this and it's there for the purpose of designers displaying popups and such like.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...