Question ContainerControl

Pirahnaplant

Well-known member
Joined
Mar 29, 2009
Messages
75
Programming Experience
3-5
I have a custom control which inherits ContainerControl. I have 2 questions about this.

1. ContainerControls do not have the DoubleBuffered property. Is there something I can do to get the DoubleBuffered effect?

2. I would like to draw the control differently if it is focused. Is there any way I can determine whether the control itself or any of its child controls has focus?
 
1) dunno,
2) I would loop thru all the controls in the form_load event and addhandler the Enter and Leave events for them. Then make the routed sub (Enter) switch a boolean flag to True, then call Me.Refresh or Invalidate to get it to repaint. In the paint event check for this boolean and paint away. All controls will use this same subs for enter and leave.

In the Leave event you may need to check if all controls have lost focus before switching and painting that way it does not need to repaint if one of the controls in the containercontrol remain in focus.
 
Back
Top