Extending the TextBox

Hi,

I have been trying to extend the text box to add new properties like Border Color, Border Width etc. At design time things look fine, however at runtime, when the focus is set on the text box, the fonts show in bold and the control does not behave properly. It does not process the backspace and other keys.

Following is a part of the code that I wrote. In the constructor, I changed the style to 'User Paint'. I am then overriding the OnPaint method to draw the border and the text.

Public Sub New()
MyBase.New()
Me.SetStyle(ControlStyles.UserPaint, True)
End Sub

Protected Overrides Sub OnPaint(ByVal e As _
System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(e)
'
Call DrawText(e.Graphics)
Call DrawBorder(e.Graphics)
'
End Sub

could some one pl help or point me to some similar example.

thanks
Philip

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories