private void Node_Click(object sender, TreeNodeMouseClickEventArgs e) { if (MouseButtons.Right != e.Button) { return; } tv.SelectedNode = e.Node; TreeNode n = e.Node; if (n == null || n.Tag == null) { return; } ROI roi = (ROI)n.Tag; if (roi == null) { roi = (ROI)n.Parent.Tag; } int ind = 0; if (n.Text.IndexOf("Layer") > -1) { ind = int.Parse(n.Text.Substring(n.Text.LastIndexOf("r") + 1, n.Text.Length - n.Text.LastIndexOf("r") - 1)); } //ColorBrowser ColorDialog colorDialog1 = new ColorDialog(); colorDialog1.AllowFullOpen = true; colorDialog1.AnyColor = true; colorDialog1.FullOpen = true; colorDialog1.Color = roi.colors[ind]; //set Custom Colors if (IA.settings.CustomColors[IA.FileBrowser.ActiveAccountIndex] != "@") { List <int> colorsList = new List <int>(); foreach (string j in IA.settings.CustomColors[IA.FileBrowser.ActiveAccountIndex] .Split(new[] { "\t" }, StringSplitOptions.None)) { colorsList.Add(int.Parse(j)); } colorDialog1.CustomColors = colorsList.ToArray(); } // Show the color dialog. DialogResult result = colorDialog1.ShowDialog(); //Copy Custom Colors int[] colors = (int[])colorDialog1.CustomColors.Clone(); string txt = "@"; if (colors.Length > 0) { txt = colors[0].ToString(); for (int j = 1; j < colors.Length; j++) { txt += "\t" + colors[j].ToString(); } } IA.settings.CustomColors[IA.FileBrowser.ActiveAccountIndex] = txt; IA.settings.Save(); if (result == DialogResult.OK) { IA.AddToHistoryOld("Chart.SetSeriesColor(" + GetChanel(roi).ToString() + "," + roi.getID.ToString() + "," + ind.ToString() + "," + ColorTranslator.ToHtml(roi.colors[ind]) + ")"); roi.colors[ind] = colorDialog1.Color; IA.AddToHistoryNew("Chart.SetSeriesColor(" + GetChanel(roi).ToString() + "," + roi.getID.ToString() + "," + ind.ToString() + "," + ColorTranslator.ToHtml(colorDialog1.Color) + ")"); foreach (Color col in RefColors) { if (colorDialog1.Color == col) { IA.ReloadImages(); return; } } RefColors.Add(colorDialog1.Color); createImagesFortTV(colorDialog1.Color); IA.ReloadImages(); } }