diff --git a/ContextMenuManager/BluePointLilac.Methods/ControlExtension.cs b/ContextMenuManager/BluePointLilac.Methods/ControlExtension.cs
index 04ad777..8322140 100644
--- a/ContextMenuManager/BluePointLilac.Methods/ControlExtension.cs
+++ b/ContextMenuManager/BluePointLilac.Methods/ControlExtension.cs
@@ -8,19 +8,27 @@ namespace BluePointLilac.Methods
{
[DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
+
[DllImport("user32.dll")]
private static extern bool ReleaseCapture();
private const int WM_NCLBUTTONDOWN = 0xA1;
private const int HT_CAPTION = 0x2;
/// 使控件能够移动所属窗体
- /// 副作用:使用此方法将无法触发Click等事件
/// 目标控件
public static void CanMoveForm(this Control ctr)
{
- ctr.MouseDown += (sender, e) =>
+ DateTime downTime = DateTime.MinValue;
+ DateTime upTime = DateTime.MinValue;
+ ctr.MouseDown += (sender, e) => downTime = DateTime.Now;
+ ctr.MouseUp += (sender, e) => upTime = DateTime.Now;
+ ctr.MouseMove += (sender, e) =>
{
- if(e.Button == MouseButtons.Left && ctr.FindForm().WindowState == FormWindowState.Normal)
+ foreach(DateTime time in new[] { downTime, upTime })
+ {
+ if((DateTime.Now - time).TotalMilliseconds < 20) return;
+ }
+ if(e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(ctr.FindForm().Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
diff --git a/ContextMenuManager/BluePointLilac.Methods/ImageExtension.cs b/ContextMenuManager/BluePointLilac.Methods/ImageExtension.cs
index f7f0074..a33ea18 100644
--- a/ContextMenuManager/BluePointLilac.Methods/ImageExtension.cs
+++ b/ContextMenuManager/BluePointLilac.Methods/ImageExtension.cs
@@ -22,6 +22,7 @@ namespace BluePointLilac.Methods
public static Image ResizeImage(this Image image, int width, int height)
{
+ if(image.Width == width && image.Height == height) return image;
Bitmap destImage = new Bitmap(width, height);
destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
using(Graphics g = Graphics.FromImage(destImage))
@@ -44,6 +45,7 @@ namespace BluePointLilac.Methods
public static Image ResizeImage(this Image image, double scale)
{
+ if(scale == 1) return image;
int width = (int)(image.Width * scale);
int height = (int)(image.Height * scale);
return image.ResizeImage(width, height);
@@ -51,6 +53,7 @@ namespace BluePointLilac.Methods
public static Image ResizeImage(this Image image, Size newSize)
{
+ if(newSize == image.Size) return image;
return image.ResizeImage(newSize.Width, newSize.Height);
}
diff --git a/ContextMenuManager/ContextMenuManager.csproj b/ContextMenuManager/ContextMenuManager.csproj
index bd0910d..bd31b2e 100644
--- a/ContextMenuManager/ContextMenuManager.csproj
+++ b/ContextMenuManager/ContextMenuManager.csproj
@@ -114,6 +114,10 @@
+
+
+ Form
+
Component
diff --git a/ContextMenuManager/Controls/NewShellDialog.cs b/ContextMenuManager/Controls/NewShellDialog.cs
index 66d4461..06f82d9 100644
--- a/ContextMenuManager/Controls/NewShellDialog.cs
+++ b/ContextMenuManager/Controls/NewShellDialog.cs
@@ -103,8 +103,9 @@ namespace ContextMenuManager.Controls
{
using(OpenFileDialog dlg = new OpenFileDialog())
{
- dlg.Filter = $"{AppString.Dialog.Program}|*.exe;*.bat;*.cmd;*.pif;*.com;*.vbs;*.vbe;*.js;*.jse;*.wsf";
+ dlg.Filter = $"{AppString.Dialog.Program}|*.exe;*.bat;*.cmd;*.vbs;*.vbe;*.js;*.jse;*.wsf";
if(dlg.ShowDialog() != DialogResult.OK) return;
+ Arguments = string.Empty;
ItemText = Path.GetFileNameWithoutExtension(dlg.FileName);
string extension = Path.GetExtension(dlg.FileName).ToLower();
switch(extension)
@@ -114,6 +115,7 @@ namespace ContextMenuManager.Controls
case ".js":
case ".jse":
case ".wsf":
+ chkSE.Checked = true;
ItemFilePath = "wscript.exe";
Arguments = dlg.FileName;
break;