Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 14th, 2012  |  syntax: None  |  size: 0.67 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Build a paint program [closed]
  2. Bitmap bitmap = new Bitmap(pictureBox1.Size.Width, pictureBox1.Size.Height);
  3.  
  4.        bitmap.SetPixel(100, 100, Color.Pink);  
  5.        Graphics ModelGraphic = Graphics.FromImage(bitmap);
  6.  
  7.  
  8.       for (int i = 0; i < 100; i++)
  9.       bitmap.SetPixel(i, 10, Color.Pink);
  10.  
  11.         pictureBox1.Image = bitmap;
  12.        
  13. private void button1_Click(object sender, EventArgs e)
  14. {
  15.     Bitmap bitmap = new Bitmap(pictureBox1.Size.Width, pictureBox1.Size.Height);
  16.     bitmap.SetPixel(100, 100, Color.Pink);  
  17.     Graphics ModelGraphic = Graphics.FromImage(bitmap);
  18.     for (int i = 0; i < 100; i++)
  19.     bitmap.SetPixel(i, 10, Color.Pink);
  20.     pictureBox1.Image = bitmap;
  21. }