TextBox OnPaint override never gets called

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to override the TextBox OnPaint method, but it never gets called. Why? How can I tailor the painting of a TextBox?
 
Now with the SetStyle(ControlStyles.UserPaint, true); set my OnPaint does get called, but now a call to base.OnPaint(e); is basically ignored, and during user editting, it appears that my OnPaint is not called. I want to let the TextBox do its normal painting, but tweek it a little afterwords. Does anyone have sample code that modifies the OnPaint of a system control (preferably a TextBox control).
 
Hi Mark,

Thanks for your post!

Just as Shawn said in his post, we didn't call DefWndProc in Base.OnPaint
method when the UserPaint flag is set. So if you would like to do some
customizing after the default painting, you need override the WndProc and
handle the WM_PAINT and other messages as you did in native codes, ofcourse
it requires full trust.

Could you also share with us that What effect would you like to get, maybe
some community members have some idea on it.
Thanks!


Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, "online" should be removed before
sending.
 
Back
Top