Hamburger1984 Posted July 29, 2003 Posted July 29, 2003 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 Quote
*Experts* Volte Posted July 29, 2003 *Experts* Posted July 29, 2003 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 OnDesignerDeactivateThen 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. Quote
Hamburger1984 Posted July 29, 2003 Author Posted July 29, 2003 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 Quote
*Experts* Volte Posted July 29, 2003 *Experts* Posted July 29, 2003 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. Quote
Hamburger1984 Posted July 29, 2003 Author Posted July 29, 2003 ...but can an OwnedForm be a TopLevel Form? Quote
*Experts* Volte Posted July 29, 2003 *Experts* Posted July 29, 2003 No such thing exists. All controls/forms can be owned by other control/forms. Quote
*Gurus* divil Posted July 30, 2003 *Gurus* Posted July 30, 2003 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. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.