RespondWeb.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Security.Permissions;
  5. using System.Windows.Forms;
  6. using System.Drawing;
  7. using System.Runtime.InteropServices;
  8. using System.Threading;
  9. using System.Text.RegularExpressions;
  10. using US.Browser.IE.BLL;
  11. using System.Reflection;
  12. namespace US.Browser.IE
  13. {
  14. /// <summary>
  15. /// 功能接口区域
  16. /// </summary>
  17. [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
  18. [System.Runtime.InteropServices.ComVisibleAttribute(true)]
  19. public class RespondWeb
  20. {
  21. public BrowserDAO _UBF;
  22. public WebBrowser UB;
  23. /// <summary>
  24. /// 无参数构造
  25. /// </summary>
  26. public RespondWeb() { }
  27. /// <summary>
  28. /// 页面初始化
  29. /// </summary>
  30. /// <param name="WB"></param>
  31. public RespondWeb(WebBrowser WB, BrowserDAO uba)
  32. {
  33. this.UB = WB; _UBF = uba;
  34. }
  35. /// <summary>
  36. /// 构造函数 此类设置为窗口功能区域
  37. /// </summary>
  38. public RespondWeb(BrowserDAO _USY, FVCBrower _UTV)
  39. {
  40. _UBF = _USY;
  41. try { _USY._UWB.ObjectForScripting = this; }
  42. catch (Exception e) { }
  43. }
  44. #region 操作收藏夹
  45. /// <summary>
  46. /// 打开添加收藏控件窗体
  47. /// </summary>
  48. /// <param name="ITF"></param>
  49. public void OpenAddFVC(int ITF)
  50. {
  51. WebBrowser BL = this._UBF._UBL[ITF];
  52. this._UBF._UFV.OpenAddFVC(BL);
  53. }
  54. /// <summary>
  55. /// 打开收藏列表
  56. /// </summary>
  57. public void OpenFV(int ITF)
  58. {
  59. this._UBF._UFV.OpenFV(this._UBF._UBL[ITF]);
  60. }
  61. #endregion
  62. #region 页面操作
  63. /// <summary>
  64. /// 新建窗口
  65. /// </summary>
  66. /// <param name="url"></param>
  67. /// <param name="name"></param>
  68. public bool AddABrowser(string UURL, string UN, bool UTF)
  69. {
  70. WebBrowser _WB = this._UBF.AddBrowser(UURL, UN);
  71. if (this._UBF._UBL.Count > 1) { SetWindow(); } return true;
  72. }
  73. /// <summary>
  74. /// 获取指定的路径
  75. /// </summary>
  76. public string GetLJ()
  77. {
  78. return Application.StartupPath + "\\html";
  79. }
  80. /// <summary>
  81. /// 跳转谷歌
  82. /// </summary>
  83. /// <param name="_thisURL"></param>
  84. /// <returns></returns>
  85. public string WysGoogle(string _thisURL)
  86. {
  87. string g = "http://g.helloit.info/";
  88. if (Regex.Match(_thisURL.ToLower(), "google").Success)
  89. {
  90. return g;
  91. }
  92. return _thisURL;
  93. }
  94. //声明委托
  95. public delegate void AsyncEventHandler(string UURL, string UN);
  96. /// <summary>
  97. /// 载入网址
  98. /// </summary>
  99. /// <param name="url"></param>
  100. /// <param name="name"></param>
  101. public void LoadUrl(string UURL, string UN)
  102. {
  103. AsyncEventHandler asy = new AsyncEventHandler(ZR);
  104. IAsyncResult ia = asy.BeginInvoke(UURL, UN, null, null);
  105. }
  106. /// <summary>
  107. /// 异步获取
  108. /// </summary>
  109. public void ZR(string UURL, string UN)
  110. {
  111. int i = 0; bool _UTF = USIE.MyPing(UURL, out i);
  112. this._UBF._UF.Invoke(new Action<string>(delegate(string a) { this._UBF.ModifyOneBrowser(UN, WysGoogle(UURL == "" ? "http://seo.1473.cn/Client/taobao.html" : UURL)); }), "");
  113. }
  114. /// <summary>
  115. /// 获取更新
  116. /// </summary>
  117. public string GetGX()
  118. {
  119. return USClientCommunicate.GetPage("http://seo.1473.cn/Client/ver.txt");
  120. }
  121. /// <summary>
  122. /// 获取当前浏览器版本号
  123. /// </summary>
  124. /// <returns></returns>
  125. public string IsGX()
  126. {
  127. return StaticClass.ver;
  128. }
  129. /// <summary>
  130. /// 上一页
  131. /// </summary>
  132. /// <param name="name"></param>
  133. public void Previous(string UN)
  134. {
  135. this._UBF.FindBrowser(UN).GoBack();
  136. }
  137. /// <summary>
  138. /// 上一页
  139. /// </summary>
  140. /// <param name="name"></param>
  141. public void Next(string UN)
  142. {
  143. this._UBF.FindBrowser(UN).GoForward();
  144. }
  145. /// <summary>
  146. /// 刷新
  147. /// </summary>
  148. /// <param name="name"></param>
  149. public void Refresh(string UN)
  150. {
  151. WebBrowser _UWB = this._UBF.FindBrowser(UN);
  152. BLL.WindowHWND.freem(); _UWB.Url = new Uri(_UWB.Url.ToString()); // _UWB.Refresh();
  153. }
  154. /// <summary>
  155. /// 加载主页
  156. /// </summary>
  157. /// <param name="name"></param>
  158. public void LoadHome(string UN)
  159. {
  160. this.LoadUrl(System.IO.Path.GetFullPath("html/blank.html"), UN);
  161. }
  162. /// <summary>
  163. /// 生成页面的信息
  164. /// </summary>
  165. /// <param name="UN"></param>
  166. /// <returns></returns>
  167. public string SV(string UN)
  168. {
  169. return this._UBF.BrowserToJson(this._UBF.FindBrowser(UN), false);
  170. }
  171. #endregion
  172. #region 页面功能区域
  173. /// <summary>
  174. /// 设置
  175. /// </summary>
  176. public void Setup()
  177. {
  178. this._UBF.RS.SetProxy();
  179. }
  180. /// <summary>
  181. /// 清除IE的缓存
  182. /// </summary>
  183. public void clean()
  184. {
  185. USIE.CMD("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255");
  186. }
  187. /// <summary>
  188. /// 停止加载
  189. /// </summary>
  190. /// <param name="name"></param>
  191. public void Stop(string UN)
  192. {
  193. this._UBF.FindBrowser(UN).Stop();
  194. }
  195. /// <summary>
  196. /// 关闭一个浏览器
  197. /// </summary>
  198. /// <param name="name"></param>
  199. /// <returns></returns>
  200. public bool CloseOneBrowser(string UN)
  201. {
  202. this._UBF.CloseOneBrowser(UN);
  203. return true;
  204. }
  205. /// <summary>
  206. /// 关闭窗体
  207. /// </summary>
  208. public void CloseForm()
  209. {
  210. this._UBF._UF.Hide();
  211. BLL.WindowHWND.freem();
  212. }
  213. /// <summary>
  214. /// 新建窗体
  215. /// </summary>
  216. /// <param name="url"></param>
  217. public void NewForm(string UURL)
  218. {
  219. StaticClass.getInstance();
  220. }
  221. /// <summary>
  222. /// 设置可见,将选中的browser可见,其余隐藏
  223. /// </summary>
  224. /// <param name="name"></param>
  225. public bool SetVisible(string UN)
  226. {
  227. int i; WebBrowser _UWB = _UBF.FindBrowser(UN); List<WebBrowser> _UBL = this._UBF._UBL;
  228. for (i = 0; i < _UBL.Count; i++)
  229. {
  230. _UWB = _UBL[i];
  231. if (_UBL[i].Name == UN) { _UWB.Visible = true; if (_UWB.Document != null) { _UWB.Document.Window.Focus(); } }
  232. else { _UBL[i].Visible = false; }
  233. }
  234. BLL.WindowHWND.freem(); return true;
  235. }
  236. /// <summary>
  237. /// 显示的窗体聚焦
  238. /// </summary>
  239. public void fouscwindow()
  240. {
  241. int i; List<WebBrowser> _UBL = this._UBF._UBL;
  242. for (i = 0; i < _UBL.Count; i++) { if (_UBL[i].Visible == true && _UBL[i].Document != null) { _UBL[i].Document.Window.Focus(); } }
  243. }
  244. /// <summary>
  245. /// 打开查看1473内容
  246. /// </summary>
  247. public void OpenLook(object[] UDE, WebBrowser _UWB)
  248. {
  249. try
  250. {
  251. WebBrowser _UBE = _UWB != null ? _UWB : GetWebBrowser("http://www.1473.cn"); VisibleBrowser(_UBE);
  252. if (_UBE.Document == null)
  253. {
  254. DocCompleted _UTE = new DocCompleted(); _UTE.UDE = UDE;
  255. _UBE.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(_UTE._UBE_DocumentCompleted);
  256. }
  257. else { _UBE.Document.InvokeScript("YDHJH", UDE); }
  258. }
  259. catch (Exception e) { }
  260. }
  261. /// <summary>
  262. /// 加载完毕
  263. /// </summary>
  264. public class DocCompleted
  265. {
  266. public object[] UDE;
  267. /// <summary>
  268. /// 加载完毕
  269. /// </summary>
  270. /// <param name="sender"></param>
  271. /// <param name="e"></param>
  272. public void _UBE_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
  273. {
  274. WebBrowser _UBW = (WebBrowser)sender;
  275. if (_UBW.ReadyState == WebBrowserReadyState.Complete && e.Url == _UBW.Url)
  276. {
  277. _UBW.DocumentCompleted -= new WebBrowserDocumentCompletedEventHandler(_UBE_DocumentCompleted);
  278. _UBW.Document.InvokeScript("YDHJH", UDE); UDE = null;
  279. }
  280. }
  281. }
  282. /// <summary>
  283. /// 获取指定域名下的webbrower
  284. /// </summary>
  285. /// <returns></returns>
  286. public WebBrowser GetWebBrowser(string URL)
  287. {
  288. WebBrowser _UWB = this._UBF.FindWebUrl(URL); string _UN = Guid.NewGuid().ToString();
  289. if (_UWB == null) { this._UBF._UWB.Document.InvokeScript("_addTag", new object[] { URL, _UN }); _UWB = this._UBF.FindBrowser("a" + _UN); }
  290. return _UWB;
  291. }
  292. /// <summary>
  293. /// 设置webrower可见
  294. /// </summary>
  295. /// <param name="UW"></param>
  296. public void VisibleBrowser(WebBrowser UW)
  297. {
  298. bool _UTF; int i; List<WebBrowser> _UBL = this._UBF._UBL; Form _UFE = this._UBF._UF;
  299. for (i = 0; i < _UBL.Count; i++) { _UTF = UW == _UBL[i]; _UBL[i].Visible = _UTF; if (_UTF && _UBL[i].Document != null) { _UBL[i].Document.Window.Focus(); } }
  300. this._UBF._UF.Show(); if (this._UBF._UF.WindowState == FormWindowState.Minimized) { this._UBF._UF.WindowState = FormWindowState.Normal; } this._UBF._UF.BringToFront();
  301. }
  302. /// <summary>
  303. /// 闪烁消息查看
  304. /// </summary>
  305. public void ftpshow(string json)
  306. {
  307. ftp ff = new ftp(json, UB, this);
  308. }
  309. /// <summary>
  310. /// 取消闪烁消息
  311. /// </summary>
  312. public void QXftpshow()
  313. {
  314. StaticClass._twstop();
  315. StaticClass._USE.USIcon.MouseClick -= StaticClass._ume;
  316. }
  317. /// <summary>
  318. /// 消息查看
  319. /// </summary>
  320. /// <param name="json"></param>
  321. public void news(string json)
  322. {
  323. StaticClass._UNE.TFP(json, this.UB, this);
  324. }
  325. /// <summary>
  326. /// 取消消息查看
  327. /// </summary>
  328. public void removenew()
  329. {
  330. StaticClass._UNE.remove();
  331. }
  332. #endregion
  333. #region 设置页面大小变化
  334. /// <summary>
  335. /// 设置窗体可见
  336. /// </summary>
  337. public void SetWindow()
  338. {
  339. Form _UFE = this._UBF._UF; _UFE.Show();
  340. if (_UFE.WindowState == FormWindowState.Minimized || _UFE.Visible == false) { _UFE.WindowState = FormWindowState.Normal; _UFE.Location = new Point((Screen.PrimaryScreen.WorkingArea.Width - _UFE.Width) / 2, (Screen.PrimaryScreen.WorkingArea.Height - _UFE.Height) / 2); }
  341. }
  342. /// <summary>
  343. /// 只显示网页部分
  344. /// </summary>
  345. public void BigScreen()
  346. {
  347. this._UBF.TYUWBF11((WebBrowser)_UBF._UWB);
  348. }
  349. /// <summary>
  350. /// 设置全屏和缩小
  351. /// </summary>
  352. public bool FormMaximized()
  353. {
  354. Form _UF = this._UBF._UF;
  355. if (_UF.WindowState == FormWindowState.Maximized)//全屏缩小
  356. {
  357. _UF.WindowState = FormWindowState.Normal;
  358. BLL.WindowHWND.freem(); return false;
  359. }
  360. else//全屏
  361. {
  362. _UF.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size;
  363. _UF.WindowState = FormWindowState.Maximized;
  364. return true;
  365. }
  366. }
  367. /// <summary>
  368. /// 最小化
  369. /// </summary>
  370. public void FormMinimized()
  371. {
  372. StaticClass._USE.Visible = true;
  373. this._UBF._UF.WindowState = FormWindowState.Minimized;
  374. }
  375. /// <summary>
  376. /// 窗体变大
  377. /// </summary>
  378. public void Larger()
  379. {
  380. Rectangle _UDX = _UBF._UF.DesktopBounds, _USZ = System.Windows.Forms.Screen.GetWorkingArea(new Point(0, 0));
  381. if (_USZ.Width == _UDX.Width && _USZ.Height == _USZ.Height) { _UBF._UF.Location = new Point(100, 100); _UBF._UF.Size = new Size(1064, 600); }
  382. else { _UBF._UF.DesktopBounds = _USZ; }
  383. }
  384. /// <summary>
  385. /// 最大化和原大小
  386. /// </summary>
  387. public void DFullS()
  388. {
  389. bool FSTF = FormMaximized();//设置到制定大小
  390. DXBH(FSTF);//大小变化
  391. }
  392. /// <summary>
  393. /// 设置大小变化
  394. /// </summary>
  395. /// <param name="tf"></param>
  396. public void DXBH(bool tf)
  397. {
  398. Point? _UPt, _TPt; Size? _UPs, _TPs; int[] i = new int[] { tf ? 0 : 2, tf ? 0 : 4 };
  399. _TPt = new Point(i[0], i[0]); _UPt = new Point(i[0], _UBF._UWB.Height + i[0]);//webbrower位置
  400. _TPs = new Size(_UBF._UF.Width - i[1], _UBF._UWB.Height); _UPs = new Size(_UBF._UF.Width - i[1], _UBF._UF.Height - _UBF._UWB.Height - i[1]);//头和内容webbrower大小
  401. BSSZ(_UPt, _TPt, _UPs, _TPs);//设置大小
  402. }
  403. /// <summary>
  404. /// 窗口里大小和位置定位
  405. /// </summary>
  406. /// <param name="TSI"></param>
  407. /// <param name="TY"></param>
  408. public void BSSZ(Point? UTY, Point? TTY, Size? UTS, Size? TTS)
  409. {
  410. CWB(UTY, UTS); TopWBF11(TTY, TTS);
  411. }
  412. /// <summary>
  413. /// 里面的webbrower修改大小
  414. /// </summary>
  415. /// <param name="TY"></param>
  416. /// <param name="_UBP"></param>
  417. public void CWB(Point? TY, Size? _UBP)
  418. {
  419. int i; List<WebBrowser> _UL = this._UBF._UBL; WebBrowser _UWB;
  420. for (i = 0; i < _UL.Count; i++)
  421. {
  422. _UWB = _UL[i];
  423. FVCBrower.ChangeBrower(_UWB, TY, _UBP, true);
  424. }
  425. }
  426. /// <summary>
  427. /// 头部F11设置
  428. /// </summary>
  429. /// <param name="_TopBL"></param>
  430. /// <param name="_ts"></param>
  431. private void TopWBF11(Point? _TopBL, Size? _ts)
  432. {
  433. FVCBrower.ChangeBrower((WebBrowser)_UBF._UWB, _TopBL, _ts, false);
  434. }
  435. /// <summary>
  436. /// 全屏后鼠标移动效果
  437. /// </summary>
  438. /// <param name="TF"></param>
  439. public void WYDC(bool TF)
  440. {
  441. WebBrowser _TopWB = _UBF._UWB;
  442. if (_TopWB.Location.Y == -35) if (TF) _TopWB.BringToFront(); else _TopWB.SendToBack();
  443. }
  444. #endregion
  445. #region 窗口拖动
  446. //窗体拖动
  447. [DllImport("user32.dll")]
  448. public static extern bool ReleaseCapture();//API函数
  449. public const int WM_SYSCOMMAND = 0x0112;//该变量表示将向Windows发送消息的类型
  450. public const int SC_MOVE = 0xF010;//该变量表示发送消息的附加消息
  451. public const int HTCAPTION = 0x0002;
  452. [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
  453. static extern IntPtr PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
  454. [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
  455. static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
  456. [DllImport("user32.dll", SetLastError = true)]
  457. static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);
  458. [DllImport("user32.dll", CharSet = CharSet.Auto)]
  459. static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
  460. /// <summary>
  461. /// 拖动
  462. /// </summary>
  463. public void _Main_Drag()
  464. {
  465. ReleaseCapture();//该函数从当前线程中释放鼠标捕获事件,并恢复鼠标输入处理
  466. IntPtr _e = SendMessage(_UBF._UF.Handle, WM_SYSCOMMAND, (IntPtr)(SC_MOVE + HTCAPTION), IntPtr.Zero);
  467. }
  468. /// <summary>
  469. /// 窗体拖动后使用
  470. /// </summary>
  471. /// <param name="x"></param>
  472. /// <param name="y"></param>
  473. public void WBSJ(int x, int y)
  474. {
  475. IntPtr handle = _UBF._UWB.Handle;
  476. StringBuilder className = new StringBuilder(100);
  477. while (className.ToString() != "Internet Explorer_Server")
  478. {
  479. handle = GetWindow(handle, 5);
  480. GetClassName(handle, className, className.Capacity);
  481. }
  482. const uint upCode = 0x202;
  483. PostMessage(handle, upCode, IntPtr.Zero, (IntPtr)((y << 16) | x));
  484. }
  485. #endregion
  486. #region 没用的函数
  487. //public string AddFV(string FVC, string FVH, string CID, string UID)
  488. //{
  489. // string a = US.Browser.IE.BLL.USClientCommunicate.PostPage("http://collect.1473.cn:1334", "POST", "mode=", "UseBE_AddFV", "{ UID:'" + UID + "',CateID:'" + CID + "',href:'" + FVH + "',herfc:'" + FVC + "'}");
  490. // return a;
  491. //}
  492. /// <summary>
  493. /// 一直全屏z
  494. /// </summary>
  495. //public void YZQP(Point? WZ)
  496. //{
  497. // Form _UF = _UBF._UF; List<WebBrowser> _WL = _UBF._UBL; WebBrowser _TWB; int i;
  498. // _UF.WindowState = FormWindowState.Maximized;
  499. // if (WZ != null)
  500. // {
  501. // for (i = 0; i < _WL.Count; i++)
  502. // {
  503. // if ((_TWB = _WL[i]).Visible == false) continue;
  504. // FVCBrower.ChangeBrower(_TWB, WZ, new Size(_TWB.Width, _UBF._UF.Height - 4), true);
  505. // }
  506. // }
  507. //}
  508. // /// <summary>e
  509. ///// 响应web对form的请求
  510. ///// </summary>
  511. //[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
  512. //[System.Runtime.InteropServices.ComVisibleAttribute(true)]
  513. //private BrowserDAO _browserDao;
  514. //private FVCBrower _fvcBrower;
  515. //bool fullScreen = false; //设置窗体一开始的状态
  516. ///// <summary>
  517. ///// 构造函数
  518. ///// </summary>
  519. ///// <param name="webBrowser">请求的WebBrowser</param>
  520. ///// <param name="form">窗体</param>
  521. //public RespondWeb(BrowserDAO broDao, FVCBrower FB)
  522. //{
  523. // this._browserDao = broDao;
  524. // this._fvcBrower = FB;
  525. // try
  526. // {
  527. // this._browserDao._webBrowser.ObjectForScripting = this;
  528. // }
  529. // catch (Exception e)
  530. // {
  531. // MessageBox.Show(e.ToString(), "错误");
  532. // }
  533. //}
  534. ////打开添加收藏控件窗体
  535. //public void OpenAddFVC(int i)
  536. //{
  537. // WebBrowser BL = (WebBrowser)_browserDao.BrowserList[i];
  538. // _fvcBrower.OpenAddFVC(BL);
  539. //}
  540. ////打开收藏列表
  541. //public void OpenFV()
  542. //{
  543. // _fvcBrower.OpenFV();
  544. //}
  545. ///*被动对主窗体的动作*/
  546. ////新建窗体
  547. //public void AddABrowser(string url, string name)
  548. //{
  549. // _browserDao.AddBrowser(url, name);
  550. // //if (WaitWebPageLoad((WebBrowser)_browserDao.BrowserList[_browserDao.BrowserList.Count - 1]))
  551. // //string name = ((WebBrowser)_browserDao.BrowserList[_browserDao.BrowserList.Count - 1]).Name;
  552. // //return _browserDao.BrowserToJson(name);
  553. //}
  554. ////载入网址
  555. //public void LoadUrl(string url, string name)
  556. //{
  557. // _browserDao.ModifyOneBrowser(name, url);
  558. //}
  559. ////上一页
  560. //public void Previous(string name)
  561. //{
  562. // _browserDao.FindBrowser(name).GoBack();
  563. //}
  564. ////下一页
  565. //public void Next(string name)
  566. //{
  567. // _browserDao.FindBrowser(name).GoForward();
  568. //}
  569. ////刷新
  570. //public void Refresh(string name)
  571. //{
  572. // _browserDao.FindBrowser(name).Refresh();
  573. //}
  574. ////加载主页
  575. //public void LoadHome(string name)
  576. //{
  577. // this.LoadUrl(System.IO.Path.GetFullPath("html/blank.html"), name);
  578. //}
  579. ////设置
  580. //public void Setup()
  581. //{
  582. // //StaticClass.LoadUrl = System.IO.Path.GetFullPath("html/setting.html");
  583. // StaticClass.urlType = "setting";
  584. // this.NewForm(System.IO.Path.GetFullPath("html/setting.html"));
  585. //}
  586. ////停止加载
  587. //public void Stop(string name)
  588. //{
  589. // _browserDao.FindBrowser(name).Stop();
  590. //}
  591. ////关闭一个浏览器控件
  592. //public bool CloseOneBrowser(string name)
  593. //{
  594. // _browserDao.CloseOneBrowser(name);
  595. // return true;
  596. //}
  597. ////最大化
  598. //public void FormMaximized()
  599. //{
  600. // if (this._browserDao.form.WindowState == FormWindowState.Normal)
  601. // {
  602. // this._browserDao.form.WindowState = FormWindowState.Maximized;
  603. // }
  604. // else if (this._browserDao.form.WindowState == FormWindowState.Maximized)
  605. // {
  606. // this._browserDao.form.WindowState = FormWindowState.Normal;
  607. // }
  608. //}
  609. ////最小化
  610. //public void FormMinimized()
  611. //{
  612. // this._browserDao.form.WindowState = FormWindowState.Minimized;
  613. //}
  614. ////关闭窗体
  615. //public void CloseForm()
  616. //{
  617. // //this._browserDao.form.Close();
  618. // this._browserDao.form.Hide();
  619. //}
  620. ////新建窗体
  621. //public void NewForm(string url)
  622. //{
  623. // StaticClass.LoadUrl = url;
  624. // StaticClass.getInstance();
  625. //}
  626. ///// <summary>
  627. ///// 设置可见,将选中的browser可见,其余隐藏
  628. ///// </summary>
  629. ///// <param name="name"></param>
  630. //public bool SetVisible(String name)
  631. //{
  632. // WebBrowser WB = new WebBrowser();
  633. // try
  634. // {
  635. // foreach (WebBrowser wb in _browserDao.BrowserList)
  636. // {
  637. // wb.Visible = false;
  638. // if (wb.Name == name)
  639. // {
  640. // wb.Visible = true;
  641. // WB = wb;
  642. // continue;
  643. // }
  644. // }
  645. // }
  646. // catch { Thread.Sleep(150); WB.Document.Focus(); }
  647. // return true;
  648. //}
  649. //public static void SetTimeout(double interval, Action action)
  650. //{
  651. // System.Timers.Timer timer = new System.Timers.Timer(interval);
  652. // timer.Elapsed += delegate(object sender, System.Timers.ElapsedEventArgs e)
  653. // {
  654. // timer.Enabled = false;
  655. // action();
  656. // };
  657. // timer.Enabled = true;
  658. //}
  659. ///// <summary>
  660. ///// 右键菜单
  661. ///// </summary>
  662. ////public void ContextMenuStrip(string name)
  663. ////{
  664. //// this._browserDao._broStrip.Show(1);
  665. //// this._browserDao._broStrip._respndStrip._borwserName = name;
  666. ////}
  667. ///// <summary>
  668. ///// 隐藏右键菜单
  669. ///// </summary>
  670. ////public void HiddenContextMenuStrip()
  671. ////{
  672. //// this._browserDao._broStrip.Hidden();
  673. ////}
  674. ////窗体变大
  675. //public void Larger()
  676. //{
  677. // fullScreen = !fullScreen;
  678. // if (fullScreen)
  679. // {
  680. // this._browserDao.form.DesktopBounds = System.Windows.Forms.Screen.GetWorkingArea(new Point(0, 0));//获取或设置window桌面上的的大小和位置
  681. // }
  682. // else
  683. // {
  684. // this._browserDao.form.Location = new Point(100, 100);//设置窗体变小之后位置
  685. // this._browserDao.form.Size = new Size(1064, 600);//设置窗体变小之后大小
  686. // }
  687. //}
  688. //public void FullScreen()
  689. //{
  690. // if (this._browserDao.form.WindowState == FormWindowState.Normal)
  691. // {
  692. // this._browserDao.form.FormBorderStyle = FormBorderStyle.None;
  693. // this._browserDao.form.WindowState = FormWindowState.Maximized;
  694. // }
  695. // else if (this._browserDao.form.WindowState == FormWindowState.Maximized)
  696. // {
  697. // if (this._browserDao.form.FormBorderStyle == FormBorderStyle.Sizable)
  698. // {
  699. // this._browserDao.form.FormBorderStyle = FormBorderStyle.None;
  700. // this._browserDao.form.WindowState = FormWindowState.Normal;
  701. // this._browserDao.form.WindowState = FormWindowState.Maximized;
  702. // }
  703. // else
  704. // {
  705. // this._browserDao.form.FormBorderStyle = FormBorderStyle.Sizable;
  706. // this._browserDao.form.WindowState = FormWindowState.Normal;
  707. // }
  708. // }
  709. //}//全屏
  710. //public void BigScreen()
  711. //{
  712. // int i;
  713. // WebBrowser temp = new WebBrowser();
  714. // Button _Quit = new Button();
  715. // temp = (WebBrowser)US.Browser.IE.USMain.formList[0].Controls.Find("USBrowserNav", true)[0];//获取窗体上的控件
  716. // temp.MinimumSize = new Size(1064, 0);
  717. // temp.Size = new Size(1064, 0);
  718. // for (i = 0; i < _browserDao.BrowserList.Count; i++)
  719. // {
  720. // WebBrowser a = new WebBrowser();
  721. // a = (WebBrowser)_browserDao.BrowserList[i];
  722. // a.Location = new Point(0, 0);
  723. // a.Size = new Size(1064, a.Size.Height + 65);
  724. // }
  725. // FullScreen();
  726. // //_Quit.Location = new Point(0, 0);
  727. // //_Quit.Visible = true;
  728. //}//只显示网页的部分,上面的WebBrowser不要了
  729. ////窗体拖动
  730. //[DllImport("user32.dll")]
  731. //public static extern bool ReleaseCapture();//API函数
  732. //[DllImport("user32.dll")]
  733. //public static extern bool SendMessage(IntPtr hwdn, int wMsg, int mParam, int lParam);//接受发送来的消息 并处理
  734. //public const int WM_SYSCOMMAND = 0x0112;//该变量表示将向Windows发送消息的类型
  735. //public const int SC_MOVE = 0xF010;//该变量表示发送消息的附加消息
  736. //public const int HTCAPTION = 0x0002;
  737. //public void _Main_Drag()
  738. //{
  739. // ReleaseCapture();//该函数从当前线程中释放鼠标捕获事件,并恢复鼠标输入处理
  740. // SendMessage(this._browserDao.form.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
  741. //}
  742. #endregion
  743. }
  744. }