|
' ==============================================================================
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
' ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
' THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
' PARTICULAR PURPOSE.
'
' � 2003-2004 LaMarvin. All Rights Reserved.
'
' FMI: http://www.vbinfozine.com/a_default.shtml
' ==============================================================================
Imports LaMarvin.Windows.Forms
Friend Class LabelDisplayAdapter
Implements IDropDownDisplayAdapter
Public Sub New(ByVal adaptee As Label)
Debug.Assert(Not adaptee Is Nothing)
Me._Label = adaptee
Me._Label.TextAlign = ContentAlignment.MiddleCenter
Me._Label.Cursor = Cursors.Hand
Me._Label.BorderStyle = BorderStyle.FixedSingle
End Sub
Public ReadOnly Property Adaptee() As System.Windows.Forms.Control Implements LaMarvin.Windows.Forms.IDropDownDisplayAdapter.Adaptee
Get
Return Me._Label
End Get
End Property
Public Property Color() As System.Drawing.Color Implements LaMarvin.Windows.Forms.IDropDownDisplayAdapter.Color
Get
Return Me._Label.BackColor
End Get
Set(ByVal Value As System.Drawing.Color)
Me._Label.BackColor = Value
Me._Label.ForeColor = ColorPicker.GetInvertedColor(Value)
End Set
End Property
Public Event DropDownAppearanceChanged As EventHandler Implements LaMarvin.Windows.Forms.IDropDownDisplayAdapter.DropDownAppearanceChanged
Public Property HasDropDownAppearance() As Boolean Implements LaMarvin.Windows.Forms.IDropDownDisplayAdapter.HasDropDownAppearance
Get
Return Me._HasDropDownAppearance
End Get
Set(ByVal Value As Boolean)
If Value = Me._HasDropDownAppearance Then
Return
End If
Me._HasDropDownAppearance = Value
RaiseEvent DropDownAppearanceChanged(Me, EventArgs.Empty)
End Set
End Property
Public Property Text() As String Implements LaMarvin.Windows.Forms.IDropDownDisplayAdapter.Text
Get
Return Me._Label.Text
End Get
Set(ByVal Value As String)
Me._Label.Text = Value
End Set
End Property
Private Sub _Label_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles _Label.MouseDown
Me.HasDropDownAppearance = Not Me.HasDropDownAppearance
End Sub
Private WithEvents _Label As Label
Private _HasDropDownAppearance As Boolean
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I live in Slovakia with my wife, two sons and two daughters. I've been doing Microsoft Windows development since 1988; primarily in VB. I'm a big fan of the MS .NET framework, publisher of the
www.vbinfozine.com ezine and the author of components found at
www.lamarvin.com.