Exemplo n.º 1
0
 /// <summary>
 /// Обработка изменения ширины
 /// </summary>
 /// <param name="sender">Отправитель</param>
 /// <param name="e">Параметры</param>
 private void width_TextChanged(object sender, System.EventArgs e)
 {
     try
     {
         int width = Int32.Parse(((TextBox)sender).Text);
         logic.onWidthChanged(width);
     }
     catch (Exception exc)
     {
     }
 }
Exemplo n.º 2
0
        public void DrawingTest()
        {
            MouseEventArgs args  = new MouseEventArgs(MouseButtons.Left, 0, 200, 200, -1);
            BMPLogic       logic = new BMPLogic(400, 400);

            logic.onWidthChanged(1);
            logic.startDrawing(args);
            logic.draw(new MouseEventArgs(MouseButtons.Left, 0, 250, 250, -1));
            Assert.Equal(Color.FromArgb(255, 0, 0, 0), logic.getBitmap().GetPixel(200, 200));
            Assert.Equal(Color.FromArgb(255, 0, 0, 0), logic.getBitmap().GetPixel(250, 250));
            logic = new BMPLogic(400, 400);
            logic.chooseBrush();
            logic.startDrawing(args);
            logic.draw(new MouseEventArgs(MouseButtons.Left, 0, 250, 250, -1));
            Assert.Equal(Color.FromArgb(255, 0, 0, 0), logic.getBitmap().GetPixel(200, 200));
            Assert.Equal(Color.FromArgb(255, 0, 0, 0), logic.getBitmap().GetPixel(250, 250));
            logic.chooseEraser();
            logic.startDrawing(args);
            logic.draw(new MouseEventArgs(MouseButtons.Left, 0, 250, 250, -1));
            Assert.Equal(Color.FromArgb(255, 255, 255, 255), logic.getBitmap().GetPixel(200, 200));
            Assert.Equal(Color.FromArgb(255, 255, 255, 255), logic.getBitmap().GetPixel(250, 250));
        }