No error catching but show how to use the color dialog...
Imports AcCm = Autodesk.AutoCAD.Colors
Imports AcWi = Autodesk.AutoCAD.Windows
Public Class ColorSelector
Public Function GetColor() As AcCm.Color
Dim CD As New AcWi.ColorDialog
Dim C As AcCm.Color = AcCm.Color.FromColorIndex(AcCm.ColorMethod.ByAci, 1) 'Set color to RED
CD.Color = C
CD.SetDialogTabs(AcWi.ColorDialog.ColorTabs.ACITab Xor AcWi.ColorDialog.ColorTabs.TrueColorTab) 'Do not show color books
If CD.ShowDialog <> DialogResult.OK Then
Return Nothing
End If
Return CD.Color
End Function
Public Function GetColor(ByVal DefaultColor As AcCm.Color) As AcCm.Color
Dim CD As New AcWi.ColorDialog
CD.Color = DefaultColor
CD.SetDialogTabs(AcWi.ColorDialog.ColorTabs.ACITab Xor AcWi.ColorDialog.ColorTabs.TrueColorTab) 'Do not show color books
If CD.ShowDialog <> DialogResult.OK Then
'User cancelled return default color
Return DefaultColor
End If
Return CD.Color
End Function
End Class
P.S. I have a widescreen monitor so I apologize in advance for scrolling. I'm not a big fan of continuation lines.
Message was edited by: rwilkins
Ronnie Wilkins, Jr.