/* * Histogramm in die PictureBox des Fensters zeichnen auf Grundlage der Histogramm daten */ public void draw_histogram(System.Windows.Forms.PictureBox statistik_pic, Config.histogram_canal canal) { const int width = 256; const int height = 100; Bitmap bb = new Bitmap(width, height); Graphics objGraphic = Graphics.FromImage(bb); Pen pen = new Pen(Color.Black); pen.Width = 5; objGraphic.DrawLine(pen, 0, height, width - 1, height); int peak = 0; int c = (int)canal; int value = 0; for (int x = 1; x < width; x++) { value = histo[c, x]; // Höchstwert des Kanal Wertes berechnen <- normalisiert peak = (value == 0) ? 0 : (value * height) / this.peak[(int)canal]; objGraphic.DrawLine(pen, x, height, x, height - peak); System.Drawing.Drawing2D.GraphicsState graph = objGraphic.Save(); objGraphic.Restore(graph); } statistik_pic.Image = bb; statistik_pic.Refresh(); }
private void green_channel_radio_CheckedChanged(object sender, EventArgs e) { if (green_channel_radio.Checked) { radio_button = Config.histogram_canal.GREEN; con.draw_histogram(statistikPictureBox, this, radio_button); } }
private void blue_channel_radio_CheckedChanged(object sender, EventArgs e) { if (blue_channel_radio.Checked) { radio_button = Config.histogram_canal.BLUE; con.draw_histogram(statistikPictureBox, this, radio_button); } }
public void draw_histogram(System.Windows.Forms.PictureBox statistikPictureBox, Statistik form, Config.histogram_canal canal) { model.draw_histogram(statistikPictureBox, canal); mainForm.Focus(); }