Prev: simple login form
Next: downloading msdn library 2010?
From: Manish Agarwal on 8 Jun 2010 08:11 Hello, I am implementing a control derived from System.Windows.Forms.UserControl class. This look like something similar to Visual Studio 2005's dockable tab control for callstack, output, watch window etc. In my control class, I am overriding following method. override void WndProc(ref System.Windows.Forms.Message m) In this method, I am checking m.Msg for following messages: WM_ACTIVATE, WM_SETFOCUS, WM_KILLFOCUS etc. but there is no notification come even if I change the focus from my UserControl. I am getting notification for WM_PARENTNOTIFY and for my user defined messages. Please suggest, what I am missing here. Regards, Manish Agarwal
From: Peter Duniho on 9 Jun 2010 00:20 Manish Agarwal wrote: > Hello, > > I am implementing a control derived from > System.Windows.Forms.UserControl class. This look like something > similar to Visual Studio 2005's dockable tab control for callstack, > output, watch window etc. > > In my control class, I am overriding following method. > > override void WndProc(ref System.Windows.Forms.Message m) > > In this method, I am checking m.Msg for following messages: > > WM_ACTIVATE, WM_SETFOCUS, WM_KILLFOCUS etc. but there is no > notification come even if I change the focus from my UserControl. > > I am getting notification for WM_PARENTNOTIFY and for my user defined > messages. > > Please suggest, what I am missing here. No one can say for sure what you are missing if you don't post the code. But you should make sure that your control sub-class returns "true" for CanFocus. You should also make sure that UserControl is really the most suitable base class for your control. The name implies a more general-purpose class than it really is; it's actually a "designable" composite control that can contain other controls. Fully custom controls that are complete controls unto themselves, without additional child controls contained within, are better implemented as sub-classes of Control, not UserControl. Pete
|
Pages: 1 Prev: simple login form Next: downloading msdn library 2010? |