if (radListBox_SelectLOBs.Items.Count > 0) { radListBox_SelectITMs.ContextMenuStrip = contextMenuStrip_VF; }
Public Class RadMaskedEditBoxX
Inherits Telerik.WinControls.UI.RadMaskedEditBox
Public Sub New()
Me.EnableTheming = False
End Sub
Protected Overrides Sub OnReadOnlyChanged(ByVal e As System.EventArgs)
MyBase.OnReadOnlyChanged(e)
If Me.ReadOnly Then
SetColor(SystemColors.Control)
Else
SetColor(SystemColors.Window)
End If
End Sub
Public Sub SetColor(ByVal clrColor As Color)
MyBase.MaskedEditBoxElement.Fill.GradientStyle = Telerik.WinControls.GradientStyles.Solid
MyBase.MaskedEditBoxElement.Fill.BackColor = clrColor
MyBase.MaskedEditBoxElement.Border.ForeColor = SystemColors.WindowFrame
'--------------------------------------------------------------------
' This Line does not work correctly with the Control Color, it does with any other color.
' When set to Control it still blends itself with white so is some light grey color
'(very hard to tell difference from white (non-readonly) textbox).
MyBase.MaskedEditBoxElement.BackColor = SystemColors.Control
' -------------------------------------------------------------------
' This is my fix for this problem, To blend the color so it is not = SystemColors.Control but very close
'MyBase.MaskedEditBoxElement.BackColor = modShared.BlendColor(SystemColors.Control, Color.White, 1)
End Sub
Public Overrides Property ThemeClassName() As String
Get
Return GetType(Telerik.WinControls.UI.RadMaskedEditBox).FullName
End Get
Set(ByVal value As String)
MyBase.ThemeClassName = value
End Set
End Property
Public Function BlendColor(ByVal p_Color1 As Color, ByVal p_Color2 As Color, ByVal p_blend As Integer) As Color
Try
Dim r As Single, g As Single, b As Single
Dim dr As Single, dg As Single, db As Single
dr = (p_Color2.R - p_Color1.R) / 255
dg = (p_Color2.G - p_Color1.G) / 255
db = (p_Color2.B - p_Color1.B) / 255
r = p_Color1.R
g = p_Color1.G
b = p_Color1.B
BlendColor = Color.FromArgb(r + (dr * p_blend), g + (dg * p_blend), b + (db * p_blend))
Catch
Try
Dim r As Single, g As Single, b As Single
Dim dr As Single, dg As Single, db As Single
dr = (p_Color1.R - p_Color2.R) / 255
dg = (p_Color1.G - p_Color2.G) / 255
db = (p_Color1.B - p_Color2.B) / 255
r = p_Color2.R
g = p_Color2.G
b = p_Color2.B
BlendColor = Color.FromArgb(r + (dr * p_blend), g + (dg * p_blend), b + (db * p_blend))
Catch
If p_blend < 127 Then
BlendColor = p_Color1
Else
BlendColor = p_Color2
End If
End Try
End Try
End Function
End Class