diff --git a/FRControl/App.config b/FRControl/App.config
index 5f4c8b8..5c290d3 100644
--- a/FRControl/App.config
+++ b/FRControl/App.config
@@ -29,7 +29,7 @@
Resources/person.png
- http://xz.wh.hbjc.gov.cn/
+ https://www.12309.gov.cn/front-cas/login
Resources/caseInfo.png
diff --git a/FRControl/Home.cs b/FRControl/Home.cs
index bc21ffb..4c45132 100644
--- a/FRControl/Home.cs
+++ b/FRControl/Home.cs
@@ -45,7 +45,7 @@ namespace FRControl
//
WebView webView = new WebView();
title = Properties.Settings.Default.caseName;
- url = Properties.Settings.Default.caseInformation;
+ url = Properties.Settings.Default.lawyerInterview;
//webView.param = Properties.Settings.Default.caseInformation;
webView.Show();
}
@@ -56,7 +56,7 @@ namespace FRControl
//System.Diagnostics.Process.Start(Properties.Settings.Default.lawyerInterview);
WebView webView = new WebView();
title = Properties.Settings.Default.lawyerName;
- url = Properties.Settings.Default.lawyerInterview;
+ url = Properties.Settings.Default.caseInformation;
//webView.param = Properties.Settings.Default.caseInformation;
webView.Show();
}
diff --git a/FRControl/WebView.Designer.cs b/FRControl/WebView.Designer.cs
index 0e193b1..6a9acfb 100644
--- a/FRControl/WebView.Designer.cs
+++ b/FRControl/WebView.Designer.cs
@@ -48,7 +48,7 @@
this.webBrowser1.ScriptErrorsSuppressed = true;
this.webBrowser1.Size = new System.Drawing.Size(608, 1053);
this.webBrowser1.TabIndex = 0;
- this.webBrowser1.Url = new System.Uri("http://www.baidu.com", System.UriKind.Absolute);
+ this.webBrowser1.Url = new System.Uri("http://xz.wh.hbjc.gov.cn/", System.UriKind.Absolute);
this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted_1);
//
// BodyPanel
diff --git a/FRControl/WebView.cs b/FRControl/WebView.cs
index 99b9bf3..32a7ad0 100644
--- a/FRControl/WebView.cs
+++ b/FRControl/WebView.cs
@@ -1,4 +1,5 @@
-using System;
+using Microsoft.Win32;
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@@ -14,11 +15,13 @@ namespace FRControl
{
public WebView()
{
-
+
+ SetWebBrowserFeatures(11);
InitializeComponent();
Size WindowsScreenSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
- Console.WriteLine(WindowsScreenSize);
int width = Screen.PrimaryScreen.Bounds.Width;
+ //Console.WriteLine("WindowsScreenSize:" + WindowsScreenSize+ ",width:"+ width);
+
if (width == 1080)
{
this.Size = new Size(1080, 1920);
@@ -43,6 +46,7 @@ namespace FRControl
this.webBrowser1.ScrollBarsEnabled = false;
}
+
private void webBrowser1_DocumentCompleted_1(object sender, WebBrowserDocumentCompletedEventArgs e)
{
//System.IO.StreamReader sr = new System.IO.StreamReader(webBrowser1.DocumentStream, Encoding.GetEncoding("gb2312"));
@@ -53,6 +57,11 @@ namespace FRControl
//int end = html.IndexOf("", start) + 8;
//string tbhtm = html.Substring(start, end - start);
+ if (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
+ return;
+ //if (e.Url.ToString() != webBrowser1.Url.ToString())
+ // return;
+
//webBrowser1.DocumentText = tbhtm;//设置为table的html代码
//将所有的链接的目标,指向本窗体
foreach (HtmlElement htmlElement in webBrowser1.Document.Links)
@@ -65,10 +74,12 @@ namespace FRControl
Size sz = webBrowser1.Size;
int xbili = (int)((float)sz.Width / (float)szba.Width * 100);//水平方向缩小比例
int ybili = (int)((float)sz.Height / (float)szba.Height * 100);//垂直方向缩小比例
- if (xbili < ybili)
- webBrowser1.Document.Body.Style = "zoom:" + xbili.ToString() + "%";
- else
- webBrowser1.Document.Body.Style = "zoom:" + ybili.ToString() + "%";
+ 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();
}
private void Window_Error(object sender, HtmlElementErrorEventArgs e)
@@ -85,15 +96,110 @@ namespace FRControl
}
private void ReturnBtn_Click(object sender, EventArgs e)
{
+ this.webBrowser1.Dispose();
this.Close();
}
- private void webBrowser1_DocumentCompleted_2(object sender, WebBrowserDocumentCompletedEventArgs e)
+ //private void webBrowser1_DocumentCompleted_2(object sender, WebBrowserDocumentCompletedEventArgs e)
+ //{
+
+ //}
+ private void TitleLab_Click(object sender, EventArgs e)
{
}
- private void TitleLab_Click(object sender, EventArgs e)
+
+ ///
+ /// 修改注册表信息来兼容当前程序
+ ///
+ ///
+ static void SetWebBrowserFeatures(int ieVersion)
{
+ // don't change the registry if running in-proc inside Visual Studio
+ if (LicenseManager.UsageMode != LicenseUsageMode.Runtime)
+ return;
+ //获取程序及名称
+ var appName = System.IO.Path.GetFileName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
+ //得到浏览器的模式的值
+ UInt32 ieMode = GeoEmulationModee(ieVersion);
+ var featureControlRegKey = @"HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\";
+ //设置浏览器对应用程序(appName)以什么模式(ieMode)运行
+ Registry.SetValue(featureControlRegKey + "FEATURE_BROWSER_EMULATION",
+ appName, ieMode, RegistryValueKind.DWord);
+ // enable the features which are "On" for the full Internet Explorer browser
+ //不晓得设置有什么用
+ Registry.SetValue(featureControlRegKey + "FEATURE_ENABLE_CLIPCHILDREN_OPTIMIZATION",
+ appName, 1, RegistryValueKind.DWord);
+
+
+ //Registry.SetValue(featureControlRegKey + "FEATURE_AJAX_CONNECTIONEVENTS",
+ // appName, 1, RegistryValueKind.DWord);
+
+
+ //Registry.SetValue(featureControlRegKey + "FEATURE_GPU_RENDERING",
+ // appName, 1, RegistryValueKind.DWord);
+
+ //Registry.SetValue(featureControlRegKey + "FEATURE_WEBOC_DOCUMENT_ZOOM",
+ // appName, 1, RegistryValueKind.DWord);
+
+
+ //Registry.SetValue(featureControlRegKey + "FEATURE_NINPUT_LEGACYMODE",
+ // appName, 0, RegistryValueKind.DWord);
+ }
+ ///
+ /// 获取浏览器的版本
+ ///
+ ///
+ static int GetBrowserVersion()
+ {
+ int browserVersion = 0;
+ using (var ieKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer",
+ RegistryKeyPermissionCheck.ReadSubTree,
+ System.Security.AccessControl.RegistryRights.QueryValues))
+ {
+ var version = ieKey.GetValue("svcVersion");
+ if (null == version)
+ {
+ version = ieKey.GetValue("Version");
+ if (null == version)
+ throw new ApplicationException("Microsoft Internet Explorer is required!");
+ }
+ int.TryParse(version.ToString().Split('.')[0], out browserVersion);
+ }
+ //如果小于7
+ if (browserVersion < 7)
+ {
+ throw new ApplicationException("不支持的浏览器版本!");
+ }
+ return browserVersion;
+ }
+ ///
+ /// 通过版本得到浏览器模式的值
+ ///
+ ///
+ ///
+ static UInt32 GeoEmulationModee(int browserVersion)
+ {
+ UInt32 mode = 11000; // Internet Explorer 11. Webpages containing standards-based !DOCTYPE directives are displayed in IE11 Standards mode.
+ switch (browserVersion)
+ {
+ case 7:
+ mode = 7000; // Webpages containing standards-based !DOCTYPE directives are displayed in IE7 Standards mode.
+ break;
+ case 8:
+ mode = 8000; // Webpages containing standards-based !DOCTYPE directives are displayed in IE8 mode.
+ break;
+ case 9:
+ mode = 9000; // Internet Explorer 9. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode.
+ break;
+ case 10:
+ mode = 10000; // Internet Explorer 10.
+ break;
+ case 11:
+ mode = 11000; // Internet Explorer 11
+ break;
+ }
+ return mode;
}
}
}