Skip to content

Commit

Permalink
2021-09-27
Browse files Browse the repository at this point in the history
  • Loading branch information
poerin committed Sep 26, 2021
1 parent ae6bbdc commit 55a6393
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Stroke/Draw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ public void DrawPath(Point start, Point end)
API.LineTo(canvas, end.X - rect.Left, end.Y - rect.Top);
}

public void Clear()
{
API.RECT rect;
API.GetWindowRect(client, out rect);
API.InvalidateRect(client, ref rect, true);
}

public void Dispose()
{
API.ReleaseDC(client, canvas);
Expand Down
6 changes: 3 additions & 3 deletions Stroke/Stroke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Stroke
{
public partial class Stroke : Form
public class Stroke : Form
{
private Draw draw;
private bool stroking = false;
Expand Down Expand Up @@ -99,6 +99,8 @@ private bool MouseHook_MouseAction(MouseHook.MouseActionArgs args)
else if (args.MouseButtonState == MouseHook.MouseButtonStates.Up)
{
stroking = false;
draw.Clear();
Refresh();
Visible = false;
TopMost = false;

Expand All @@ -116,8 +118,6 @@ private bool MouseHook_MouseAction(MouseHook.MouseActionArgs args)
return true;
}

Refresh();

if (stroked)
{
Gesture gesture = new Gesture("", drwaingPoints);
Expand Down

0 comments on commit 55a6393

Please sign in to comment.