serhat

serhat

  • NA
  • 4
  • 0

drawing outside of controls in onPaint

Sep 12 2008 2:26 AM

Hi,

I am asked to draw rounded rectangles around our controls, and add a caption to left of them. Now I know that this is very easy with user control. Suppose I want to modify a textbox, Add our textbox, add a label to the left , override onpaint for drawing rectangular frame and etc.

However, the controls that I am to modify are 3rd party controls, which are frequently updated by vendor. My manager doesnt want me to modify the user controls' code to expose new properties of constituent control with getters setters every time they are introduced in new versions.

If I create a non-user control which is inherited from our textbox, all public properties of textbox will be automatically exposed in this new control, so no need to modify the code on new versions of the textbox. My question is, is it possible for me to draw outside of the control bounderies in the paint event of the inherited control itself  (drawing rectangular frame around it, drawing text to left of it etc.)? Or am i bound by the area of the base control, and unable to draw outside of it in its paint event?

Any higher level comments are also welcomed, thanks in advance.


Answers (3)