I have the following Structure
I have PropertyGrid1 that show properties of custom control, for BorderColors property i use a custom editor to select each border color.
I overrides ToString function to make the PropertyGrid1 shows the RGB values of all borders if they are equals and String.Empty if not.
My problem is that, the PropertyGrid1 shows the value in read only text box, i want to enter text like 206,177,215 (RGB format) and interpret to color and assign to all borders without needing to drop down my custom editor.
Interpreting 206,177,215 to color is not problem, the problem is how to enter it in the PropertyGrid1.
Code:
Public Structure BorderColors
Public Top As Color
Public Right As Color
Public Bottom As Color
Public Left As Color
Public Sub New(all As Color)
Left = all
Top = all
Right = all
Bottom = all
End Sub
Public Sub New(cLeft As Color, cTop As Color, cRight As Color, cBottom As Color)
Left = cLeft
Top = cTop
Right = cRight
Bottom = cBottom
End Sub
Public Overrides Function ToString() As String
If Left = Top AndAlso Left = Right AndAlso Left = Bottom Then
Return Left.R & "," & Left.G & "," & Left.B
Else
Return String.Empty
End If
End Function
End Structure
I overrides ToString function to make the PropertyGrid1 shows the RGB values of all borders if they are equals and String.Empty if not.
My problem is that, the PropertyGrid1 shows the value in read only text box, i want to enter text like 206,177,215 (RGB format) and interpret to color and assign to all borders without needing to drop down my custom editor.
Interpreting 206,177,215 to color is not problem, the problem is how to enter it in the PropertyGrid1.