In short, yes. MSDN covers here . The problem is that this is not done using Color- you need to process the value in the form of BGR sets, i.e. Each integer consists of colors like 00BBGGRR, so you shift the blue color to 16, the green color to 8 and use red “as is”.
My VB sucks, but in C # to add purple:
using (ColorDialog dlg = new ColorDialog())
{
Color purple = Color.Purple;
int i = (purple.B << 16) | (purple.G << 8) | purple.R;
dlg.CustomColors = new[] { i };
dlg.ShowDialog();
}
Reflectorassures me that it looks like:
Using dlg As ColorDialog = New ColorDialog
Dim purple As Color = Color.Purple
Dim i As Integer = (((purple.B << &H10) Or (purple.G << 8)) Or purple.R)
dlg.CustomColors = New Integer() { i }
dlg.ShowDialog
End Using
source
share