private void generateColorStops()
        {
            int numColorStops = PaletteManager.CurrentPalette.Count;

            PaletteColorStops = new List <ColorStop>();

            //pnl_ColorEditor.SuspendLayout();
            for (int i = 0; i < PaletteManager.CurrentPalette.Count; i++)
            {
                PaletteColor pc = PaletteManager.CurrentPalette[i];
                Color        currentColorStopColor;
                if (PaletteManager.CurrentPalette.HSL)
                {
                    currentColorStopColor = Palette.HSLtoRGBConversion(pc.Component1, pc.Component2, pc.Component3);
                }
                else
                {
                    currentColorStopColor = Color.FromArgb((int)pc.Component1, (int)pc.Component2, (int)pc.Component3);
                }

                int       ColorStopLocation = ((int)(pc.Location * NumOfDivisionsFromZero) * PaletteEditorDisplayColorWidthInPixels) + pctbx_PaletteEditor.Location.X - ColorStopOffset + PaletteEditorPaletteX;
                ColorStop newCS             = new ColorStop(i, ColorStopLocation, currentColorStopColor, i == SelectedColorStop,
                                                            new EventHandler(ColorStop_Click), new EventHandler(ColorStop_DoubleClick),
                                                            new MouseEventHandler(ColorStop_MouseDown), new MouseEventHandler(ColorStop_MouseMove));



                PaletteColorStops.Add(newCS);

                pctbx_PaletteEditor.Controls.Add(PaletteColorStops[i].Image);
            }
            //pnl_ColorEditor.ResumeLayout(false);
        }
        public void updateSelectedColorStop()
        {
            PaletteColor pc = PaletteManager.CurrentPalette[SelectedColorStop];
            Color        currentColorStopColor;

            if (PaletteManager.CurrentPalette.HSL)
            {
                currentColorStopColor = Palette.HSLtoRGBConversion(pc.Component1, pc.Component2, pc.Component3);
            }
            else
            {
                currentColorStopColor = Color.FromArgb((int)pc.Component1, (int)pc.Component2, (int)pc.Component3);
            }

            PaletteColorStops[SelectedColorStop].Color = currentColorStopColor;
            PaletteColorStops[SelectedColorStop].Image.Refresh();
        }