views:

204

answers:

2

I'm currently coding in VB.net.

A user places the cursor in a table cell and clicks on "Table > Background Color" to edit the current background colour.

Currently I have been able to detect the current colour (for instance a light blue) and set that colour in the ColorDialog (Colour swatches are correct and RGB values are correct).

What I would like to do is enable the user to click on the "Add to Custom Colors" to save the colour. Problem is, it sets the first square in the custom colours area (which happens to already be filled in with another custom colour), rather than finding the next square that is white and set it there instead.

Is this possible?

If the user selects a new custom colour square when they first load the ColorDialog, the current colour (light blue) disappears and the colour swatches and RGB values are set as white.

Thanks

+1  A: 

I have figured out a different way to achieve my goal...

Before I load the ColorDialog, I loop through CustomColors and see if the colour I have clicked on is one of those values, if not, I add it to the CustomColors array.

In this way the colour I click on in the interface can then be selected in the custom colors UI and can be altered by the user if required.

Hannah
A: 

Refer to this SO answer it has all the details on storing and obtaining the 16 values from the settings.settings file SO related Answer

Another thing to note, is that the order of the 16 values in up and down not hozitonally from left to right.

0 2 4 6 8 10 12 14

1 3 5 7 9 11 13 15

Anonymous Type