The color palette was a little tricky, when using the Forms.ColorDiaplog control and custom colors. The custom color list must be integer, but you can't use the color.toargb. The work around is
dim intColor = Microsoft.VisualBasic.RGB(color.R, color.G,color.B).ToString
for each color in the custom list. I'm not sure if the list is fixed at 16 colors, but when I assign custom color to a list of 50 colors the dialog only displays 16 custom color. In addition, the return color list is only 16 colors.
It helps to read up a bit on the Windows Color Model.
Another pitfall was attempting to turn the custom color integer list back into windows colors. You will be tempted to use the obvious
c = Color.FromArgb(intarr(idx))
routine, but no, you must use
c = System.Drawing.ColorTranslator.FromOle(intarr(idx))
No comments:
Post a Comment