Skip to content

Commit

Permalink
修复 #3 #4
Browse files Browse the repository at this point in the history
  • Loading branch information
hyjiacan committed Apr 7, 2020
1 parent 65d3f80 commit 090d5d2
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 3.3.3

- 将截图与录屏的默认目录修改为桌面
- 修复 #3 #4

## 3.3.2

Expand Down
4 changes: 2 additions & 2 deletions ColorWanted/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.3.2")]
[assembly: AssemblyFileVersion("3.3.2")]
[assembly: AssemblyVersion("3.3.3")]
[assembly: AssemblyFileVersion("3.3.3")]
65 changes: 45 additions & 20 deletions ColorWanted/ext/FormExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static void InvokeMethod(this Form form, FormInvoker invoker)
{
return;
}
// fix #3 #4
try
{
if (form.InvokeRequired)
Expand Down Expand Up @@ -53,17 +54,29 @@ public static void SlideIn(this Form form, Action callback)
{
var step = 8;
var offset = 0;
while (offset < form.Width)
// fix #3 #4
try
{
var step1 = step;
form.InvokeMethod(() =>
while (offset < form.Width)
{
form.Left -= step1;
Application.DoEvents();
});
offset += step1;
step = (int)(step * 1.5);
Thread.Sleep(50);
var step1 = step;
form.InvokeMethod(() =>
{
form.Left -= step1;
Application.DoEvents();
});
offset += step1;
step = (int)(step * 1.5);
Thread.Sleep(50);
}
}
catch (ThreadAbortException)
{
// ignore
}
catch (ObjectDisposedException)
{
// ignore
}
if (callback != null)
{
Expand All @@ -78,23 +91,35 @@ public static void SlideOut(this Form form)
new Thread(() =>
{
var step = 8;
while (form.Width > 0)
// fix #3 #4
try
{
var step1 = step;
while (form.Width > 0)
{
var step1 = step;
form.InvokeMethod(() =>
{
form.Width -= step1;
form.Left += step1;
});
step = (int)(step * 1.5);
Thread.Sleep(50);
}
form.InvokeMethod(() =>
{
form.Width -= step1;
form.Left += step1;
form.Width = 0;
form.Left = Util.GetScreenSize().Width;
form.Hide();
});
step = (int)(step * 1.5);
Thread.Sleep(50);
}
form.InvokeMethod(() =>
catch (ThreadAbortException)
{
form.Width = 0;
form.Left = Util.GetScreenSize().Width;
form.Hide();
});
// ignore
}
catch (ObjectDisposedException)
{
// ignore
}
})
{ IsBackground = true }.Start();
}
Expand Down

0 comments on commit 090d5d2

Please sign in to comment.