Guest User

Untitled

a guest
Oct 29th, 2011
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.25 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.IO;
  10.  
  11. namespace ImageEditor
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.        
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.         private void button1_Click(object sender, EventArgs e)
  22.         {
  23.             OpenFileDialog opendialog = new OpenFileDialog();
  24.             opendialog.ShowDialog();
  25.             Bitmap bit1 = new Bitmap(opendialog.FileName);
  26.             pictureBox1.Image = bit1;
  27.  
  28.         }
  29.  
  30.         private void button3_Click(object sender, EventArgs e)
  31.         {
  32.             colordiag.ShowDialog();
  33.            
  34.         }
  35.  
  36.         private void pictureBox1_Click(object sender, EventArgs e)
  37.         {
  38.             using (Graphics gra = Graphics.FromImage(pictureBox1.Image))
  39.             {
  40.                 Point pnt1 = new Point(MousePosition.X);
  41.                 Point pnt2 = new Point(MousePosition.Y);
  42.                 using (Pen pen1 = new Pen(colordiag.Color))
  43.                 {
  44.                     gra.DrawLine(pen1, pnt1, pnt2);
  45.                 }
  46.             }
  47.             pictureBox1.Refresh();
  48.            
  49.         }
  50.  
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment