home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic .NET - Read Less - Learn More
/
Visual_Basic.NET_Read_Less_Learn_More_Richard_Bowman_Visual_2002.iso
/
Resources
/
Code
/
Ch12-HandleDefaultProperties
/
UserControl1.vb
< prev
Wrap
Text File
|
2001-09-04
|
2KB
|
71 lines
Public Class UserControl1
Inherits System.Windows.Forms.UserControl
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'UserControl1 overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.Container
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'UserControl1
'
Me.Name = "UserControl1"
Me.Size = New System.Drawing.Size(192, 120)
End Sub
#End Region
Private myBackColor As Color
Private Sub UserControl1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub UserControl1_EnabledChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.EnabledChanged
' do not allow this control to be disabled
If Me.Enabled = False Then
Me.Enabled = True
End If
End Sub
Public Overrides Property BackColor() As System.Drawing.Color
Get
Return myBackColor
End Get
Set(ByVal Value As System.Drawing.Color)
myBackColor = Value
Invalidate()
End Set
End Property
Private Sub UserControl1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim b As New Drawing2D.LinearGradientBrush(e.ClipRectangle, Color.Black, myBackColor, Drawing.Drawing2D.LinearGradientMode.Vertical)
e.Graphics.FillRectangle(b, e.ClipRectangle)
End Sub
End Class