Example #1
0
 private void ZoomPictureBox1_MouseUp(object sender, MouseEventArgs e)
 {
     if (RectOn && moving)
     {
         try
         {
             Graphics  g        = Graphics.FromImage(zoomPictureBox1.Image);
             Rectangle TempRect = FunctionClass.CreateRect(x_y, x_y2);
             g.DrawRectangle(pen, TempRect);
             toolStripStatusLabel8.Text  = Convert.ToString(TempRect.Height);
             toolStripStatusLabel11.Text = Convert.ToString(TempRect.Width);
             g.Dispose();
             zoomPictureBox1.Invalidate();
         }
         catch { }
     }
     else if (EllipsOn && moving)
     {
         try
         {
             Graphics  g        = Graphics.FromImage(zoomPictureBox1.Image);
             Rectangle TempRect = FunctionClass.CreateRect(x_y, x_y2);
             g.DrawEllipse(pen, TempRect);
             toolStripStatusLabel8.Text  = Convert.ToString(TempRect.Height);
             toolStripStatusLabel11.Text = Convert.ToString(TempRect.Width);
             g.Dispose();
             zoomPictureBox1.Invalidate();
         }
         catch { }
     }
     else if (LineOn && moving)
     {
         try
         {
             Graphics g = Graphics.FromImage(zoomPictureBox1.Image);
             FunctionClass.DrawLine(x_y, x_y2, g, pen);
             g.Dispose();
             zoomPictureBox1.Invalidate();
         }
         catch { }
     }
     //Очистка ненужной истории
     if (History[History.Count - 1] != zoomPictureBox1.image)
     {
         ChangeHistoty();
         Undo_redo();
     }
     moving = false;
 }
Example #2
0
 private void ZoomPictureBox1_Paint(object sender, PaintEventArgs e)
 {
     if (moving)
     {
         if (RectOn)
         {
             e.Graphics.DrawRectangle(new Pen(pen.Color, pen.Width * zoomPictureBox1.Zoom), FunctionClass.CreateRect(RealLocation1, RealLocation2));
         }
         else if (EllipsOn)
         {
             e.Graphics.DrawEllipse(new Pen(pen.Color, pen.Width * zoomPictureBox1.Zoom), FunctionClass.CreateRect(RealLocation1, RealLocation2));
         }
         else if (LineOn)
         {
             FunctionClass.DrawLine(RealLocation1, RealLocation2, e.Graphics, new Pen(pen.Color, pen.Width * zoomPictureBox1.Zoom));
         }
     }
     else if (TextOn)
     {
         e.Graphics.DrawString(textBox1.Text, new Font(TextFont.FontFamily, TextFont.Size * zoomPictureBox1.Zoom, TextFont.Style), new SolidBrush(FontColor), TextPoint);
     }
 }