Example #1
0
 /// <summary>
 /// Обработка Mouse move на picture
 /// </summary>
 /// <param name="sender">Отправитель</param>
 /// <param name="e">Параметры</param>
 private void pictureBox_MouseMove(object sender, MouseEventArgs e)
 {
     if (drawing)
     {
         try
         {
             if (logic.GetDrawingItem() == DrawingItem.Rectangle || logic.GetDrawingItem() == DrawingItem.Ellipse ||
                 logic.GetDrawingItem() == DrawingItem.Triangle)
             {
                 Point lastPoint = logic.getLastPoint();
                 int   x         = Math.Min(lastPoint.X, e.X),
                       y         = Math.Min(lastPoint.Y, e.Y);
                 picture.setRectangle(
                     new Rectangle(x, y, Math.Abs(e.X - lastPoint.X), Math.Abs(e.Y - lastPoint.Y)),
                     logic.GetDrawingItem());
                 picture.setPen(logic.getPen());
                 picture.Invalidate();
             }
             else
             {
                 logic.draw(e);
                 picture.Refresh();
             }
         }
         catch (Exception)
         {
         }
     }
 }
Example #2
0
        public void choosePenTest()
        {
            BMPLogic logic = new BMPLogic(200, 200);

            logic.choosePen();
            Assert.Equal(DrawingItem.Pen, logic.GetDrawingItem());
        }