Fixed the bug where resising the window and undo or clear crashes

This commit is contained in:
2022-05-31 14:16:46 +02:00
parent 9826092ce4
commit 730c09d94e
4 changed files with 5 additions and 4 deletions

View File

@@ -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;

View File

@@ -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()
{ {

View File

@@ -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;

View File

@@ -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)