G
Graham Blandford
OK, having answered my questions in a previous feed about pulling my derived
class into the IDE....
Here's a new problem that I'm hoping can be fixed and isn't a .NET bug....
I have created an inherited class based on the textbox... which, all I am
doing is allowing a forecolor to be set when .enabled is set to true.
it works nicely, EXCEPT that when I click into the box, the font (set as
default MS Sans 8.25pt) does not appear to be used and instead what looks
like an Arial 10pt or larger is used - and there is some messy painting
going on.....doesn't clear the original text and the 2 fonts run into each
other...
Here's the entire class;
Public Class LinkMAN_TextBox
Inherits System.Windows.Forms.TextBox
Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)
Dim drawBrush As New SolidBrush(Me.ForeColor)
e.Graphics.DrawString(Me.Text, Me.Font, drawBrush, 0.0F, 0.0F)
End Sub
Public Sub New()
MyBase.New()
Me.SetStyle(ControlStyles.UserPaint, True)
End Sub
End Class
I suspect this may be a bug, but if anyone can help I'd appreciate it.
Thanks,
Graham
class into the IDE....
Here's a new problem that I'm hoping can be fixed and isn't a .NET bug....
I have created an inherited class based on the textbox... which, all I am
doing is allowing a forecolor to be set when .enabled is set to true.
it works nicely, EXCEPT that when I click into the box, the font (set as
default MS Sans 8.25pt) does not appear to be used and instead what looks
like an Arial 10pt or larger is used - and there is some messy painting
going on.....doesn't clear the original text and the 2 fonts run into each
other...
Here's the entire class;
Public Class LinkMAN_TextBox
Inherits System.Windows.Forms.TextBox
Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)
Dim drawBrush As New SolidBrush(Me.ForeColor)
e.Graphics.DrawString(Me.Text, Me.Font, drawBrush, 0.0F, 0.0F)
End Sub
Public Sub New()
MyBase.New()
Me.SetStyle(ControlStyles.UserPaint, True)
End Sub
End Class
I suspect this may be a bug, but if anyone can help I'd appreciate it.
Thanks,
Graham