/* * 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(); }
public void draw_histogram(System.Windows.Forms.PictureBox statistikPictureBox, Statistik form, Config.histogram_canal canal) { model.draw_histogram(statistikPictureBox, canal); mainForm.Focus(); }