提交当前本机整理版本

This commit is contained in:
cyf
2026-07-02 10:11:39 +00:00
parent c10a5d64c7
commit aacefa24f8
822 changed files with 196665 additions and 14263 deletions
@@ -188,4 +188,32 @@ namespace Lskj.Control.BrowserSetting
//}
}
/// <summary>
/// 通过 CefBrowser 获取所在
/// 通过 CefBrowser 获取所在的 WinForms 窗口
/// </summary>
public static Form GetParentForm(CefBrowser browser,out string ModuleCode)
{
ModuleCode = "";
try
{
if (browser == null) return null;
IntPtr browserHandle = browser.GetHost().GetWindowHandle();
if (browserHandle == IntPtr.Zero) return null;
IntPtr parentHandle = GetParent(browserHandle);
if (parentHandle == IntPtr.Zero) return null;
System.Windows.Forms.Control control = System.Windows.Forms.Control.FromHandle(parentHandle);
if (control != null && control.Parent != null && control.Parent.Parent != null)
{
ModuleCode = (control.Parent.Parent).Tag + "";
}
return control as Form;
}
catch (Exception ex)
{
}
return null;
}
}
}