private void button1_Click(object sender, EventArgs e) { PiGRAPH_CLS x = new PiGRAPH_CLS(); Graph_map g = new Graph_map(); g.width = Convert.ToInt32(numericUpDown1.Value); g.height = Convert.ToInt32(numericUpDown2.Value); g.text = textBox1.Text; if (!Local.gm.BG_color.IsEmpty) { g.BG_color = Local.gm.BG_color; } else { g.BG_color = Color.Gray; } if (!Local.gm.FG_color.IsEmpty) { g.FG_color = Local.gm.FG_color; } else { g.FG_color = Color.DarkBlue; } pictureBox1.Image = x.Generate_Grph("PiGRAPH v.1.201708xx Developed by Michael B.Khany", g); Form1.ActiveForm.Text += "|"; //MessageBox.Show("Completed."); }
private Bitmap Grphesize(string input, Graph_map g, Bitmap x) { int[] Wposes = { 1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 99 }; for (int i = 0; i < Wposes.Length; i++) { Wposes[i] = i * (x.Width / 10); } int t = Math.Min(x.Height, input.Length); for (int i = 0; i < t; i++) { x.SetPixel(Wposes[Convert.ToInt32(input[i].ToString())], i, g.FG_color); } return(x); }
public Bitmap Generate_Grph(string input, Graph_map g) { Rectangle rect = new Rectangle(0, 0, g.width, g.height);//Screen.PrimaryScreen.Bounds; int color = Screen.PrimaryScreen.BitsPerPixel; PixelFormat pf; pf = PixelFormat.Format32bppArgb; Bitmap BM = new Bitmap(rect.Width, rect.Height, pf); //Parallel.For(0,BM.Width,i => { for (int i = 0; i < BM.Width; i++) { //Parallel.For(0, BM.Height, j => { for (int j = 0; j < BM.Height; j++) { BM.SetPixel(i, j, g.BG_color); } } //}); //}); BM = Grphesize(Consts.DPi_f, g, BM); return(BM); }