Exemple #1
0
        EventHandler Label_ColorChanges(Label obj, int paletteno, Func <Bitmap> getSampleBitmap)
        {
            return((sender, e) =>
            {
                Bitmap sample = getSampleBitmap();
                if (sample == null)
                {
                    return;
                }

                PaletteChangeColorsForm form = (PaletteChangeColorsForm)InputFormRef.JumpFormLow <PaletteChangeColorsForm>();
                form.SetMainColorIndex(paletteno);
                form.SetPreviewBitmap(sample);
                Color[] colormap = new Color[16 + 1];
                for (int i = 1; i <= 16; i++)
                {
                    NumericUpDown r = FindNUD("R", i);
                    NumericUpDown g = FindNUD("G", i);
                    NumericUpDown b = FindNUD("B", i);
                    form.SetColor(i, (int)r.Value, (int)g.Value, (int)b.Value);
                    colormap[i] = Color.FromArgb((int)r.Value, (int)g.Value, (int)b.Value);
                }
                DialogResult dr = form.ShowDialog();
                if (dr != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }

                PushUndo();
                this.UndoLock = true;

                for (int i = 1; i <= 16; i++)
                {
                    NumericUpDown r = FindNUD("R", i);
                    NumericUpDown g = FindNUD("G", i);
                    NumericUpDown b = FindNUD("B", i);

                    Color rgb = form.GetColor(i);
                    r.Value = rgb.R;
                    g.Value = rgb.G;
                    b.Value = rgb.B;
                }

                this.UndoLock = false;
            }
                   );
        }
Exemple #2
0
        static EventHandler MakePaletteUI_Label_ColorChanges(Form self, List <Control> controls, Label obj, int paletteno, Func <Bitmap> getSampleBitmap)
        {
            return((sender, e) =>
            {
                Bitmap sample = getSampleBitmap();
                if (sample == null)
                {
                    return;
                }

                PaletteChangeColorsForm form = (PaletteChangeColorsForm)InputFormRef.JumpFormLow <PaletteChangeColorsForm>();
                form.SetMainColorIndex(paletteno);
                form.SetPreviewBitmap(sample);
                Color[] colormap = new Color[16 + 1];
                for (int i = 1; i <= 16; i++)
                {
                    NumericUpDown r = (NumericUpDown)MakePaletteUI_FindObject <NumericUpDown>(controls, "R", i);
                    NumericUpDown g = (NumericUpDown)MakePaletteUI_FindObject <NumericUpDown>(controls, "G", i);
                    NumericUpDown b = (NumericUpDown)MakePaletteUI_FindObject <NumericUpDown>(controls, "B", i);
                    form.SetColor(i, (int)r.Value, (int)g.Value, (int)b.Value);
                    colormap[i] = Color.FromArgb((int)r.Value, (int)g.Value, (int)b.Value);
                }
                DialogResult dr = form.ShowDialog();
                if (dr != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }

                for (int i = 1; i <= 16; i++)
                {
                    NumericUpDown r = (NumericUpDown)MakePaletteUI_FindObject <NumericUpDown>(controls, "R", i);
                    NumericUpDown g = (NumericUpDown)MakePaletteUI_FindObject <NumericUpDown>(controls, "G", i);
                    NumericUpDown b = (NumericUpDown)MakePaletteUI_FindObject <NumericUpDown>(controls, "B", i);

                    Color rgb = form.GetColor(i);
                    r.Value = rgb.R;
                    g.Value = rgb.G;
                    b.Value = rgb.B;
                }
            }
                   );
        }