Textbox and setting the BackgroundImage property

  • Thread starter Thread starter Phil Jones
  • Start date Start date
P

Phil Jones

After discovering that the OnPaint method of the TextBox doesn't work - I'm
doing a work around using the TextBoxe's BackgroundImage property.

But that doesn't have any effect either. Does anyone know if I should
expect to be able to set a BackgroundImage on the textbox - is that a known
bug as well?

Thanks everyone.
 
Hi,

http://www.codeproject.com/cs/miscctrl/alphablendtextbox.asp

Ken
-----------------
After discovering that the OnPaint method of the TextBox doesn't work - I'm
doing a work around using the TextBoxe's BackgroundImage property.

But that doesn't have any effect either. Does anyone know if I should
expect to be able to set a BackgroundImage on the textbox - is that a known
bug as well?

Thanks everyone.
 
Hi Phil,

Based on my understanding, you want to set a background image to the
textbox.

.Net Textbox did have a build-in support for it. So we have to inherit and
create a customize one ourselves. To enable the custom paintint, we should
use SetStyle() method to set ControlStyles.UserPaint bit to true.

We may use Graphics.DrawImage method to draw the background image. But it
may have many problem about the text painting with the background image,
the article provided by "Ken Tucker [MVP]" did a good trick about achieve
this. I suggest you refer to that article and download the source code to
have a view.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top