Commit 4ece321c 刘韬

优化NS200窗口弹出

1 个父辈 aeedd0c5
......@@ -34,9 +34,9 @@
<Reference Include="ConfigHelper">
<HintPath>..\..\NEWSISO\DLL\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\CameraLibraryProject\CameraLibraryProject\CodeLibraryProject\CodeLibrary\bin\Debug\log4net.dll</HintPath>
<HintPath>..\SharedDll\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
......
......@@ -4,6 +4,7 @@ using Model;
using SmartScan.PlusSettingFrm;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace SmartScan
......@@ -28,8 +29,9 @@ namespace SmartScan
private void FrmSetPlus_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
this.WindowState = FormWindowState.Minimized;
this.Hide();
ShowWindow(this.Handle, SW_HIDE);
//this.WindowState = FormWindowState.Minimized;
//this.Hide();
}
private void FrmSetPlus_SizeChanged(object sender, EventArgs e)
......@@ -113,8 +115,11 @@ namespace SmartScan
BLLCommon.extension.Update();
DialogResult = DialogResult.OK;
//WindowState = FormWindowState.Minimized;
ShowWindow(this.Handle, SW_HIDE);
}
public const int SW_HIDE = 0;
[DllImport("user32.dll", EntryPoint = "ShowWindow", CharSet = CharSet.Auto)]
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
private void BtnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
......
......@@ -62,7 +62,7 @@ namespace SmartScan
if (formhwnd != IntPtr.Zero)
{
// 重新显示该窗体并切换到带入到前台
ShowWindow(formhwnd, SW_RESTORE);
ShowWindow(formhwnd, SW_SHOW);
SwitchToThisWindow(formhwnd, true);
}
else
......@@ -70,7 +70,7 @@ namespace SmartScan
formTitle = "Material Registration System";
formhwnd = FindWindow(null, formTitle);
// 重新显示该窗体并切换到带入到前台
ShowWindow(formhwnd, SW_RESTORE);
ShowWindow(formhwnd, SW_SHOW);
SwitchToThisWindow(formhwnd, true);
}
show($"窗体隐藏,查找软件窗口句柄:{formhwnd}");
......@@ -201,7 +201,9 @@ namespace SmartScan
/// <returns>如果窗体之前是可见,返回值为非零;如果窗体之前被隐藏,返回值为零</returns>
[DllImport("user32.dll", EntryPoint = "ShowWindow", CharSet = CharSet.Auto)]
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
public const int SW_HIDE = 0;
public const int SW_RESTORE = 9;
public const int SW_SHOW = 5;
[DllImport("user32.dll")]
private static extern int GetWindowTextW(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpString, int nMaxCount);
#endregion
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!