About TextBox's background color

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

Guest

I want make new controls,inhert System.Windows.Forms.TextBo
and SetStyle(ControlStyles.UserPaint, true)
But I find doesn't set background color when gotfocu
I think maybe TextBox inhert another controls,For example ComboBox have one child controls ControlID:0x3e
so i want get this ControlID and use SetBkColor function set background colo
Who can tell me ControlID or what do i
Thanks!
 
* "=?Utf-8?B?RXJpYw==?= said:
I want make new controls,inhert System.Windows.Forms.TextBox
and SetStyle(ControlStyles.UserPaint, true);
But I find doesn't set background color when gotfocus

\\\
Public Class FooBar
Inherits TextBox

Private Sub FooBar_GotFocus( _
ByVal sender As Object, _
ByVal e As System.EventArgs _
) Handles MyBase.GotFocus
Me.BackColor = Color.Yellow
End Sub

Private Sub FooBar_LostFocus( _
ByVal sender As Object, _
ByVal e As System.EventArgs _
) Handles MyBase.LostFocus
Me.BackColor = Color.White
End Sub
End Class
///
 
----- Herfried K. Wagner [MVP] wrote: -----

* "=?Utf-8?B?RXJpYw==?= said:
I want make new controls,inhert System.Windows.Forms.TextBox
and SetStyle(ControlStyles.UserPaint, true);
But I find doesn't set background color when gotfocus

\\ Public Class FooBar
Inherits TextBox

Private Sub FooBar_GotFocus( _
ByVal sender As Object, _
ByVal e As System.EventArgs _
) Handles MyBase.GotFocus
Me.BackColor = Color.Yellow
End Sub

Private Sub FooBar_LostFocus( _
ByVal sender As Object, _
ByVal e As System.EventArgs _
) Handles MyBase.LostFocus
Me.BackColor = Color.White
End Sub
End Class
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Thank you reply
You write this sample i see,but now i already SetStyle(ControlStyles.UserPaint, true);
and I override OnPaint method,because of i want change view style
so set backgroundcolor only change TextBox's backgroundColor,In TextBox.EDIT
backgroundColor doesn't change
 
Back
Top