Fixed the bug where resising the window and undo or clear crashes
This commit is contained in:
@@ -12,7 +12,7 @@ using System.Drawing;
|
|||||||
|
|
||||||
namespace Paint_2
|
namespace Paint_2
|
||||||
{
|
{
|
||||||
public class DotPencil:PaintTool
|
public class DotPencil : PaintTool
|
||||||
{
|
{
|
||||||
private List<List<Point>> _drawings;
|
private List<List<Point>> _drawings;
|
||||||
private List<List<Point>> _drawingsRedo;
|
private List<List<Point>> _drawingsRedo;
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ namespace Paint_2
|
|||||||
private void ForceRefresh()
|
private void ForceRefresh()
|
||||||
{
|
{
|
||||||
canvas.Image = sketch.ForcePaint();
|
canvas.Image = sketch.ForcePaint();
|
||||||
RefreshUi();
|
//RefreshUi();
|
||||||
}
|
}
|
||||||
private void RefreshUi()
|
private void RefreshUi()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Paint_2
|
namespace Paint_2
|
||||||
{
|
{
|
||||||
internal class Pencil : PaintTool
|
public class Pencil : PaintTool
|
||||||
{
|
{
|
||||||
private List<List<Point>> _drawings;
|
private List<List<Point>> _drawings;
|
||||||
private List<List<Point>> _drawingsRedo;
|
private List<List<Point>> _drawingsRedo;
|
||||||
@@ -48,7 +48,7 @@ namespace Paint_2
|
|||||||
{
|
{
|
||||||
Drawings[Drawings.Count -1].Add(point);
|
Drawings[Drawings.Count -1].Add(point);
|
||||||
}
|
}
|
||||||
public void Paint(Bitmap canvas)
|
public void Paint(Bitmap canvas)
|
||||||
{
|
{
|
||||||
Graphics gr = Graphics.FromImage(canvas);
|
Graphics gr = Graphics.FromImage(canvas);
|
||||||
int drawingCounter = 0;
|
int drawingCounter = 0;
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ namespace Paint_2
|
|||||||
if (newSize.Width > 0 && newSize.Height > 0)
|
if (newSize.Width > 0 && newSize.Height > 0)
|
||||||
{
|
{
|
||||||
Drawing = new Bitmap(newSize.Width, newSize.Height);
|
Drawing = new Bitmap(newSize.Width, newSize.Height);
|
||||||
|
SketchSize = newSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void ChangeTool(int toolId)
|
public void ChangeTool(int toolId)
|
||||||
|
|||||||
Reference in New Issue
Block a user