Exemplo n.º 1
0
        private void paletteButton_Click(object sender, EventArgs e)
        {
            if (openFileDialogPalette.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            // получаем выбранный файл
            string filename = openFileDialogPalette.FileName;

            pictureBoxPalette.Image = Image.FromFile(filename);
            Palette = new CalculationClass(pictureBoxPalette.Image);
            pictureBoxPalette.SizeMode = PictureBoxSizeMode.Normal;

            comboBoxPalette.FormattingEnabled = true;
            comboBoxPalette.Items.AddRange
                (new object[] { "Red", "Green", "Blue" });
            comboBoxPalette.Location              = new System.Drawing.Point(12, 515);
            comboBoxPalette.Name                  = "comboBoxPalette";
            comboBoxPalette.Size                  = new System.Drawing.Size(335, 21);
            comboBoxPalette.TabIndex              = 5;
            comboBoxPalette.Text                  = "Get the Diagram";
            comboBoxPalette.SelectedIndexChanged += new System.EventHandler(this.comboBoxPalette_SelectedIndexChanged);
            this.Controls.Add(comboBoxPalette);

            comboBoxPaletteGetChannel = new ComboBox();
            comboBoxPaletteGetChannel.FormattingEnabled = true;
            comboBoxPaletteGetChannel.Items.AddRange(new object[] { "Red", "Green", "Blue" });
            comboBoxPaletteGetChannel.Location              = new System.Drawing.Point(12, 38);
            comboBoxPaletteGetChannel.Name                  = "comboBoxPaletteGetChannel";
            comboBoxPaletteGetChannel.Size                  = new System.Drawing.Size(335, 21);
            comboBoxPaletteGetChannel.TabIndex              = 5;
            comboBoxPaletteGetChannel.Text                  = "Get the picture in needed channel";
            comboBoxPaletteGetChannel.SelectedIndexChanged += new System.EventHandler(this.comboBoxPaletteGetChannel_SelectedIndexChanged);
            this.Controls.Add(comboBoxPaletteGetChannel);
        }
Exemplo n.º 2
0
        private void buttonChange_Click(object sender, EventArgs e)
        {
            CalculationClass a = Palette;

            Palette = Origin;
            Origin  = Palette;
            Image b = pictureBoxPalette.Image;

            pictureBoxPalette.Image = pictureBoxOrigin.Image;
            pictureBoxOrigin.Image  = b;
        }
Exemplo n.º 3
0
        public FormHistogram(Form f, string channel, CalculationClass source) : this()
        {
            f.Hide();
            RGBChannel           = channel;
            somePicture          = source;
            this.chartColor.Size = new Size(500, 500);
            chartColor.Dock      = DockStyle.Fill;
            //добавляем в Chart область для рисования графиков, их может быть
            //много, поэтому даем ей имя.
            chartColor.ChartAreas.Add(new ChartArea("RGB"));

            //Создаем и настраиваем набор точек для рисования графика, в том
            //не забыв указать имя области на которой хотим отобразить этот
            //набор точек.
            Series SeriesOfColor = new Series(channel);

            SeriesOfColor.ChartType = SeriesChartType.Line;
            SeriesOfColor.ChartArea = "RGB";

            FillSeries del          = FillRedSeries;
            Channel    colorChannel = Channel.Red;

            switch (channel)
            {
            case "Green":
            {
                del          = FillGreenSeries;
                colorChannel = Channel.Green;
                break;
            }

            case "Blue":
            {
                del          = FillBlueSeries;
                colorChannel = Channel.Blue;
                break;
            }
            }
            SeriesOfColor = del.Invoke(SeriesOfColor, colorChannel);
            //SeriesOfRed=FillSeries(SeriesOfRed, Channel.Red);
            //Добавляем созданный набор точек в Chart
            chartColor.Series.Add(SeriesOfColor);//обязательно увеличить размеры области графика, менять цвет в зависимости от канала, сделать линию жирнее
        }
Exemplo n.º 4
0
        private void originButton_Click(object sender, EventArgs e)
        {
            if (openFileDialogOrigin.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            // получаем выбранный файл
            string filename = openFileDialogOrigin.FileName;

            pictureBoxOrigin.Image = Image.FromFile(filename);
            Origin = new CalculationClass(pictureBoxOrigin.Image);
            pictureBoxOrigin.SizeMode = PictureBoxSizeMode.Normal;

            comboBoxOrigin.FormattingEnabled = true;
            comboBoxOrigin.Location          = new System.Drawing.Point(395, 517);
            comboBoxOrigin.Name                  = "comboBoxOrigin";
            comboBoxOrigin.Size                  = new System.Drawing.Size(358, 21);
            comboBoxOrigin.TabIndex              = 5;
            comboBoxOrigin.Text                  = "Get the Diagram";
            comboBoxOrigin.SelectedIndexChanged += new System.EventHandler(this.comboBoxOrigin_SelectedIndexChanged);
            this.Controls.Add(comboBoxOrigin);

            if (openFileDialogOrigin.FileName != null && openFileDialogPalette.FileName != null)
            {
                Label labelSum = new Label();
                labelSum.Font     = new System.Drawing.Font("Microsoft Sans Serif", 25F);
                labelSum.Location = new System.Drawing.Point(355, 239);
                labelSum.Name     = "labelSum";
                labelSum.Size     = new System.Drawing.Size(25, 32);
                labelSum.TabIndex = 5;
                labelSum.Text     = "+";
                this.Controls.Add(labelSum);

                Button buttonChange = new Button();
                buttonChange.Font     = new System.Drawing.Font("Microsoft Sans Serif", 10F);
                buttonChange.Location = new System.Drawing.Point(360, 104);
                buttonChange.Name     = "buttonChange";
                buttonChange.Size     = new System.Drawing.Size(25, 57);
                buttonChange.TabIndex = 5;
                buttonChange.Text     = "←→\r\n";
                buttonChange.UseVisualStyleBackColor = true;
                buttonChange.Click += new System.EventHandler(this.buttonChange_Click);
                this.Controls.Add(buttonChange);

                //new comboox"=" then invoke needed method or function, then invoke OnPaint by update or smth like that for the picture box
                comboBoxGetResult      = new ComboBox();
                comboBoxGetResult.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
                comboBoxGetResult.FormattingEnabled = true;
                comboBoxGetResult.Items.AddRange(new object[] { "Lab", "HSL", "HSV" });
                comboBoxGetResult.Location = new System.Drawing.Point(756, 260);
                comboBoxGetResult.Name     = "comboBoxGetResult";
                comboBoxGetResult.Size     = new System.Drawing.Size(34, 33);
                comboBoxGetResult.TabIndex = 5;
                comboBoxGetResult.Text     = "=";
                this.Controls.Add(comboBoxGetResult);

                comboBoxGetOriginChannel = new ComboBox();
                comboBoxGetOriginChannel.FormattingEnabled = true;
                comboBoxGetOriginChannel.Items.AddRange(new object[] { "Red", "Green", "Blue" });
                comboBoxGetOriginChannel.Location = new System.Drawing.Point(403, 38);
                comboBoxGetOriginChannel.Name     = "comboBoxGetOriginChannel";
                comboBoxGetOriginChannel.Size     = new System.Drawing.Size(335, 21);
                comboBoxGetOriginChannel.TabIndex = 5;
                this.Controls.Add(comboBoxGetOriginChannel);
            }
        }