大家新年好呀。现有一问题需要请教大家,请指教呀。
在.net自带的控件中,当控件的.Enabled = False时,其控件表面的文字和图像都是灰色的,但是,在自定义控件中,怎样处理当.Enabled = False时表面的图像呢?就是说怎样画一个灰色的图像呢?
谢谢了。
[解决办法]
不是很明白什么意思
Public Class CustomControl1
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(e)
'在此处添加自定义绘制代码
Dim Control_Button As New Button
Dim Control_Textbox As New TextBox
Control_Button.Location = New Point(0, 0)
Control_Textbox.Location = New Point(0, 30)
Me.Controls.Add(Control_Button)
Me.Controls.Add(Control_Textbox)
End Sub
End Class
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If CustomControl11.Enabled = True Then
CustomControl11.Enabled = False
Else
CustomControl11.Enabled = True
End If
End Sub
End Class