diff --git a/FRControl/App.config b/FRControl/App.config index 14f152c..4d831cc 100644 --- a/FRControl/App.config +++ b/FRControl/App.config @@ -46,9 +46,6 @@ Resources/close.png - - 官网 - 案件信息公开 @@ -58,6 +55,9 @@ https://www.12309.gov.cn/front-cas/login?casLv=1&service=https://www.12309.gov.cn/sppWeb/j_spring_cas_security_check + + 门户网站 + \ No newline at end of file diff --git a/FRControl/FRControl.csproj b/FRControl/FRControl.csproj index 28eb720..4dc83cf 100644 --- a/FRControl/FRControl.csproj +++ b/FRControl/FRControl.csproj @@ -49,6 +49,9 @@ + + Component + Form diff --git a/FRControl/Properties/Settings.Designer.cs b/FRControl/Properties/Settings.Designer.cs index f8555e1..d8fb021 100644 --- a/FRControl/Properties/Settings.Designer.cs +++ b/FRControl/Properties/Settings.Designer.cs @@ -172,18 +172,6 @@ namespace FRControl.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("官网")] - public string caseName { - get { - return ((string)(this["caseName"])); - } - set { - this["caseName"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("案件信息公开")] public string lawyerName { get { @@ -218,5 +206,17 @@ namespace FRControl.Properties { this["personInterview"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("门户网站")] + public string caseName { + get { + return ((string)(this["caseName"])); + } + set { + this["caseName"] = value; + } + } } } diff --git a/FRControl/Properties/Settings.settings b/FRControl/Properties/Settings.settings index 17e3a6a..4ba7130 100644 --- a/FRControl/Properties/Settings.settings +++ b/FRControl/Properties/Settings.settings @@ -38,9 +38,6 @@ Resources/close.png - - 官网 - 案件信息公开 @@ -50,5 +47,8 @@ https://www.12309.gov.cn/front-cas/login?casLv=1&service=https://www.12309.gov.cn/sppWeb/j_spring_cas_security_check + + 门户网站 + \ No newline at end of file diff --git a/FRControl/WebView.cs b/FRControl/WebView.cs index fde680a..f406b79 100644 --- a/FRControl/WebView.cs +++ b/FRControl/WebView.cs @@ -15,7 +15,6 @@ namespace FRControl { public WebView() { - SetWebBrowserFeatures(11); InitializeComponent(); Size WindowsScreenSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); @@ -73,16 +72,27 @@ namespace FRControl //获取网页的最大size Size szba = new Size(webBrowser1.Document.Body.ScrollRectangle.Width, webBrowser1.Document.Body.ScrollRectangle.Height); Size sz = webBrowser1.Size; + //Console.WriteLine("szba:" + szba + ",sz:" + sz); int xbili = (int)((float)sz.Width / (float)szba.Width * 100);//水平方向缩小比例 int ybili = (int)((float)sz.Height / (float)szba.Height * 100);//垂直方向缩小比例 - Console.WriteLine("xbili:" + xbili + ",ybili:" + ybili); - webBrowser1.Document.Body.Style = "zoom:" + xbili.ToString() + "%"; - if (xbili < ybili) - webBrowser1.Document.Body.Style = "zoom:" + xbili.ToString() + "%"; - else - webBrowser1.Document.Body.Style = "zoom:" + ybili.ToString() + "%"; - webBrowser1.Invalidate(); - } + //Console.WriteLine("xbili:" + xbili + ",ybili:" + ybili); + //webBrowser1.Document.Body.Style = "width:1080px;"; + + //Zoom(axIWebBrowser2, 150); + + // webBrowser1.Document.Body.Style = "zoom:" + xbili.ToString() + "%"; + //if (xbili < ybili) + // webBrowser1.Document.Body.Style = "zoom:" + xbili.ToString() + "%"; + //else + // webBrowser1.Document.Body.Style = "zoom:" + ybili.ToString() + "%"; + //webBrowser1.Invalidate(); + + FRControl.ZoomBrowser.IWebBrowser2 axIWebBrowser2 = (FRControl.ZoomBrowser.IWebBrowser2)this.webBrowser1.ActiveXInstance; //关键代码 + axIWebBrowser2.ExecWB(FRControl.ZoomBrowser.OLECMDID.OLECMDID_OPTICAL_ZOOM, + FRControl.ZoomBrowser.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, + xbili, IntPtr.Zero); + } + private void Window_Error(object sender, HtmlElementErrorEventArgs e) { e.Handled = true; diff --git a/FRControl/ZoomBrowser.cs b/FRControl/ZoomBrowser.cs new file mode 100644 index 0000000..2dce4ec --- /dev/null +++ b/FRControl/ZoomBrowser.cs @@ -0,0 +1,166 @@ +using System; +using System.Windows.Forms; +using System.Runtime.InteropServices; + +namespace FRControl +{ + public partial class ZoomBrowser : WebBrowser + { + #region enums + public enum OLECMDID + { + // ... + OLECMDID_OPTICAL_ZOOM = 63, + OLECMDID_OPTICAL_GETZOOMRANGE = 64, + // ... + } + + public enum OLECMDEXECOPT + { + // ... + OLECMDEXECOPT_DONTPROMPTUSER, + // ... + } + + public enum OLECMDF + { + // ... + OLECMDF_SUPPORTED = 1 + } + #endregion + + #region IWebBrowser2 + [ComImport, /*SuppressUnmanagedCodeSecurity,*/ + TypeLibType(TypeLibTypeFlags.FOleAutomation | + TypeLibTypeFlags.FDual | + TypeLibTypeFlags.FHidden), + Guid("D30C1661-CDAF-11d0-8A3E-00C04FC9E26E")] + public interface IWebBrowser2 + { + [DispId(100)] void GoBack(); + [DispId(0x65)] void GoForward(); + [DispId(0x66)] void GoHome(); + [DispId(0x67)] void GoSearch(); + [DispId(0x68)] + void Navigate([In] string Url, + [In] ref object flags, + [In] ref object targetFrameName, + [In] ref object postData, + [In] ref object headers); + [DispId(-550)] void Refresh(); + [DispId(0x69)] void Refresh2([In] ref object level); + [DispId(0x6a)] void Stop(); + [DispId(200)] + object Application + { + [return: + MarshalAs(UnmanagedType.IDispatch)] + get; + } + [DispId(0xc9)] + object Parent + { + [return: + MarshalAs(UnmanagedType.IDispatch)] + get; + } + [DispId(0xca)] + object Container + { + [return: + MarshalAs(UnmanagedType.IDispatch)] + get; + } + [DispId(0xcb)] + object Document + { + [return: + MarshalAs(UnmanagedType.IDispatch)] + get; + } + [DispId(0xcc)] bool TopLevelContainer { get; } + [DispId(0xcd)] string Type { get; } + [DispId(0xce)] int Left { get; set; } + [DispId(0xcf)] int Top { get; set; } + [DispId(0xd0)] int Width { get; set; } + [DispId(0xd1)] int Height { get; set; } + [DispId(210)] string LocationName { get; } + [DispId(0xd3)] string LocationURL { get; } + [DispId(0xd4)] bool Busy { get; } + [DispId(300)] void Quit(); + [DispId(0x12d)] void ClientToWindow(out int pcx, out int pcy); + [DispId(0x12e)] + void PutProperty([In] string property, + [In] object vtValue); + [DispId(0x12f)] object GetProperty([In] string property); + [DispId(0)] string Name { get; } + [DispId(-515)] int HWND { get; } + [DispId(400)] string FullName { get; } + [DispId(0x191)] string Path { get; } + [DispId(0x192)] bool Visible { get; set; } + [DispId(0x193)] bool StatusBar { get; set; } + [DispId(0x194)] string StatusText { get; set; } + [DispId(0x195)] int ToolBar { get; set; } + [DispId(0x196)] bool MenuBar { get; set; } + [DispId(0x197)] bool FullScreen { get; set; } + [DispId(500)] + void Navigate2([In] ref object URL, + [In] ref object flags, + [In] ref object targetFrameName, + [In] ref object postData, + [In] ref object headers); + [DispId(0x1f5)] OLECMDF QueryStatusWB([In] OLECMDID cmdID); + [DispId(0x1f6)] + void ExecWB([In] OLECMDID cmdID, + [In] OLECMDEXECOPT cmdexecopt, + ref object pvaIn, IntPtr pvaOut); + [DispId(0x1f7)] + void ShowBrowserBar([In] ref object pvaClsid, + [In] ref object pvarShow, + [In] ref object pvarSize); + [DispId(-525)] WebBrowserReadyState ReadyState { get; } + [DispId(550)] bool Offline { get; set; } + [DispId(0x227)] bool Silent { get; set; } + [DispId(0x228)] bool RegisterAsBrowser { get; set; } + [DispId(0x229)] bool RegisterAsDropTarget { get; set; } + [DispId(0x22a)] bool TheaterMode { get; set; } + [DispId(0x22b)] bool AddressBar { get; set; } + [DispId(0x22c)] bool Resizable { get; set; } + } + #endregion + + private IWebBrowser2 axIWebBrowser2; + + public ZoomBrowser() + { + } + + protected override void AttachInterfaces( + object nativeActiveXObject) + { + base.AttachInterfaces(nativeActiveXObject); + this.axIWebBrowser2 = (IWebBrowser2)nativeActiveXObject; + } + + protected override void DetachInterfaces() + { + base.DetachInterfaces(); + this.axIWebBrowser2 = null; + } + + public void Zoom(int factor) + { + object pvaIn = factor; + try + { + this.axIWebBrowser2.ExecWB(OLECMDID.OLECMDID_OPTICAL_ZOOM, + OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, + ref pvaIn, IntPtr.Zero); + } + catch (Exception) + { + throw; + } + } + } +}