using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Permissions;
using System.Windows.Forms;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Threading;
using System.Text.RegularExpressions;
using US.Browser.IE.BLL;
using System.Reflection;

namespace US.Browser.IE
{
    /// <summary>
    /// 功能接口区域
    /// </summary>
    [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
    [System.Runtime.InteropServices.ComVisibleAttribute(true)]
    public class RespondWeb
    {
        public BrowserDAO _UBF;
        public WebBrowser UB;

        /// <summary>
        /// 无参数构造
        /// </summary>
        public RespondWeb() { }

        /// <summary>
        /// 页面初始化
        /// </summary>
        /// <param name="WB"></param>
        public RespondWeb(WebBrowser WB, BrowserDAO uba)
        {
            this.UB = WB; _UBF = uba;
        }

        /// <summary>
        /// 构造函数 此类设置为窗口功能区域
        /// </summary>
        public RespondWeb(BrowserDAO _USY, FVCBrower _UTV)
        {
            _UBF = _USY;
            try { _USY._UWB.ObjectForScripting = this; }
            catch (Exception e) { }
        }

        #region 操作收藏夹

        /// <summary>
        /// 打开添加收藏控件窗体
        /// </summary>
        /// <param name="ITF"></param>
        public void OpenAddFVC(int ITF)
        {
            WebBrowser BL = this._UBF._UBL[ITF];
            this._UBF._UFV.OpenAddFVC(BL);
        }

        /// <summary>
        /// 打开收藏列表
        /// </summary>
        public void OpenFV(int ITF)
        {
            this._UBF._UFV.OpenFV(this._UBF._UBL[ITF]);
        }


        #endregion

        #region 页面操作

        /// <summary>
        /// 新建窗口
        /// </summary>
        /// <param name="url"></param>
        /// <param name="name"></param>
        public bool AddABrowser(string UURL, string UN, bool UTF)
        {
            WebBrowser _WB = this._UBF.AddBrowser(UURL, UN);
            if (this._UBF._UBL.Count > 1) { SetWindow(); } return true;
        }

        /// <summary>
        /// 获取指定的路径
        /// </summary>
        public string GetLJ()
        {
            return Application.StartupPath + "\\html";
        }

        /// <summary>
        /// 跳转谷歌
        /// </summary>
        /// <param name="_thisURL"></param>
        /// <returns></returns>
        public string WysGoogle(string _thisURL)
        {
            string g = "http://g.helloit.info/";
            if (Regex.Match(_thisURL.ToLower(), "google").Success)
            {
                return g;
            }
            return _thisURL;
        }

        //声明委托
        public delegate void AsyncEventHandler(string UURL, string UN);

        /// <summary>
        /// 载入网址
        /// </summary>
        /// <param name="url"></param>
        /// <param name="name"></param>
        public void LoadUrl(string UURL, string UN)
        {
            AsyncEventHandler asy = new AsyncEventHandler(ZR);
            IAsyncResult ia = asy.BeginInvoke(UURL, UN, null, null);
        }

        /// <summary>
        /// 异步获取
        /// </summary>
        public void ZR(string UURL, string UN)
        {
            int i = 0; bool _UTF = USIE.MyPing(UURL, out  i);
            this._UBF._UF.Invoke(new Action<string>(delegate(string a) { this._UBF.ModifyOneBrowser(UN, WysGoogle(UURL == "" ? "http://seo.1473.cn/Client/taobao.html" : UURL)); }), "");
        }

        /// <summary>
        /// 获取更新
        /// </summary>
        public string GetGX()
        {
            return USClientCommunicate.GetPage("http://seo.1473.cn/Client/ver.txt");
        }

        /// <summary>
        /// 获取当前浏览器版本号
        /// </summary>
        /// <returns></returns>
        public string IsGX()
        {
            return StaticClass.ver;
        }

        /// <summary>
        /// 上一页
        /// </summary>
        /// <param name="name"></param>
        public void Previous(string UN)
        {
            this._UBF.FindBrowser(UN).GoBack();
        }

        /// <summary>
        /// 上一页
        /// </summary>
        /// <param name="name"></param>
        public void Next(string UN)
        {
            this._UBF.FindBrowser(UN).GoForward();
        }

        /// <summary>
        /// 刷新
        /// </summary>
        /// <param name="name"></param>
        public void Refresh(string UN)
        {
            WebBrowser _UWB = this._UBF.FindBrowser(UN);
            BLL.WindowHWND.freem(); _UWB.Url = new Uri(_UWB.Url.ToString());  // _UWB.Refresh();
        }

        /// <summary>
        /// 加载主页
        /// </summary>
        /// <param name="name"></param>
        public void LoadHome(string UN)
        {
            this.LoadUrl(System.IO.Path.GetFullPath("html/blank.html"), UN);
        }

        /// <summary>
        /// 生成页面的信息
        /// </summary>
        /// <param name="UN"></param>
        /// <returns></returns>
        public string SV(string UN)
        {
            return this._UBF.BrowserToJson(this._UBF.FindBrowser(UN), false);
        }

        #endregion

        #region 页面功能区域

        /// <summary>
        /// 设置
        /// </summary>
        public void Setup()
        {
            this._UBF.RS.SetProxy();
        }

        /// <summary>
        /// 清除IE的缓存
        /// </summary>
        public void clean()
        {
            USIE.CMD("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255");
        }

        /// <summary>
        /// 停止加载
        /// </summary>
        /// <param name="name"></param>
        public void Stop(string UN)
        {
            this._UBF.FindBrowser(UN).Stop();
        }

        /// <summary>
        /// 关闭一个浏览器
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public bool CloseOneBrowser(string UN)
        {
            this._UBF.CloseOneBrowser(UN);
            return true;
        }

        /// <summary>
        /// 关闭窗体
        /// </summary>
        public void CloseForm()
        {
            this._UBF._UF.Hide();
            BLL.WindowHWND.freem();
        }

        /// <summary>
        /// 新建窗体
        /// </summary>
        /// <param name="url"></param>
        public void NewForm(string UURL)
        {
            StaticClass.getInstance();
        }

        /// <summary>
        /// 设置可见，将选中的browser可见，其余隐藏
        /// </summary>
        /// <param name="name"></param>
        public bool SetVisible(string UN)
        {
            int i; WebBrowser _UWB = _UBF.FindBrowser(UN); List<WebBrowser> _UBL = this._UBF._UBL;
            for (i = 0; i < _UBL.Count; i++)
            {
                _UWB = _UBL[i];
                if (_UBL[i].Name == UN) { _UWB.Visible = true; if (_UWB.Document != null) { _UWB.Document.Window.Focus(); } }
                else { _UBL[i].Visible = false; }
            }
            BLL.WindowHWND.freem(); return true;
        }

        /// <summary>
        /// 显示的窗体聚焦
        /// </summary>
        public void fouscwindow()
        {
            int i; List<WebBrowser> _UBL = this._UBF._UBL;
            for (i = 0; i < _UBL.Count; i++) { if (_UBL[i].Visible == true && _UBL[i].Document != null) { _UBL[i].Document.Window.Focus(); } }
        }

        /// <summary>
        /// 打开查看1473内容
        /// </summary>
        public void OpenLook(object[] UDE, WebBrowser _UWB)
        {
            try
            {
                WebBrowser _UBE = _UWB != null ? _UWB : GetWebBrowser("http://www.1473.cn"); VisibleBrowser(_UBE);
                if (_UBE.Document == null)
                {
                    DocCompleted _UTE = new DocCompleted(); _UTE.UDE = UDE;
                    _UBE.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(_UTE._UBE_DocumentCompleted);
                }
                else { _UBE.Document.InvokeScript("YDHJH", UDE); }
            }
            catch (Exception e) { }
        }

        /// <summary>
        /// 加载完毕
        /// </summary>
        public class DocCompleted
        {
            public object[] UDE;

            /// <summary>
            /// 加载完毕
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            public void _UBE_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
            {
                WebBrowser _UBW = (WebBrowser)sender;
                if (_UBW.ReadyState == WebBrowserReadyState.Complete && e.Url == _UBW.Url)
                {
                    _UBW.DocumentCompleted -= new WebBrowserDocumentCompletedEventHandler(_UBE_DocumentCompleted);
                    _UBW.Document.InvokeScript("YDHJH", UDE); UDE = null;
                }
            }
        }

        /// <summary>
        /// 获取指定域名下的webbrower
        /// </summary>
        /// <returns></returns>
        public WebBrowser GetWebBrowser(string URL)
        {
            WebBrowser _UWB = this._UBF.FindWebUrl(URL); string _UN = Guid.NewGuid().ToString();
            if (_UWB == null) { this._UBF._UWB.Document.InvokeScript("_addTag", new object[] { URL, _UN }); _UWB = this._UBF.FindBrowser("a" + _UN); }
            return _UWB;
        }

        /// <summary>
        /// 设置webrower可见
        /// </summary>
        /// <param name="UW"></param>
        public void VisibleBrowser(WebBrowser UW)
        {
            bool _UTF; int i; List<WebBrowser> _UBL = this._UBF._UBL; Form _UFE = this._UBF._UF;
            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(); } }
            this._UBF._UF.Show(); if (this._UBF._UF.WindowState == FormWindowState.Minimized) { this._UBF._UF.WindowState = FormWindowState.Normal; } this._UBF._UF.BringToFront();
        }

        /// <summary>
        /// 闪烁消息查看
        /// </summary>
        public void ftpshow(string json)
        {
            ftp ff = new ftp(json, UB, this);
        }

        /// <summary>
        /// 取消闪烁消息
        /// </summary>
        public void QXftpshow()
        {
            StaticClass._twstop();
            StaticClass._USE.USIcon.MouseClick -= StaticClass._ume;
        }

        /// <summary>
        /// 消息查看
        /// </summary>
        /// <param name="json"></param>
        public void news(string json)
        {
            StaticClass._UNE.TFP(json, this.UB, this);
        }

        /// <summary>
        /// 取消消息查看
        /// </summary>
        public void removenew()
        {
            StaticClass._UNE.remove();
        }

        #endregion

        #region 设置页面大小变化

        /// <summary>  
        /// 设置窗体可见
        /// </summary>
        public void SetWindow()
        {
            Form _UFE = this._UBF._UF; _UFE.Show();
            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); }
        }

        /// <summary>
        /// 只显示网页部分
        /// </summary>
        public void BigScreen()
        {
            this._UBF.TYUWBF11((WebBrowser)_UBF._UWB);
        }

        /// <summary>
        /// 设置全屏和缩小
        /// </summary>
        public bool FormMaximized()
        {
            Form _UF = this._UBF._UF;
            if (_UF.WindowState == FormWindowState.Maximized)//全屏缩小
            {
                _UF.WindowState = FormWindowState.Normal;
                BLL.WindowHWND.freem(); return false;
            }
            else//全屏
            {
                _UF.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size;
                _UF.WindowState = FormWindowState.Maximized;
                return true;
            }
        }

        /// <summary>
        /// 最小化
        /// </summary>
        public void FormMinimized()
        {
            StaticClass._USE.Visible = true;
            this._UBF._UF.WindowState = FormWindowState.Minimized;
        }

        /// <summary>
        /// 窗体变大
        /// </summary>
        public void Larger()
        {
            Rectangle _UDX = _UBF._UF.DesktopBounds, _USZ = System.Windows.Forms.Screen.GetWorkingArea(new Point(0, 0));
            if (_USZ.Width == _UDX.Width && _USZ.Height == _USZ.Height) { _UBF._UF.Location = new Point(100, 100); _UBF._UF.Size = new Size(1064, 600); }
            else { _UBF._UF.DesktopBounds = _USZ; }
        }

        /// <summary>
        /// 最大化和原大小
        /// </summary>
        public void DFullS()
        {
            bool FSTF = FormMaximized();//设置到制定大小
            DXBH(FSTF);//大小变化
        }

        /// <summary>
        /// 设置大小变化
        /// </summary>
        /// <param name="tf"></param>
        public void DXBH(bool tf)
        {
            Point? _UPt, _TPt; Size? _UPs, _TPs; int[] i = new int[] { tf ? 0 : 2, tf ? 0 : 4 };
            _TPt = new Point(i[0], i[0]); _UPt = new Point(i[0], _UBF._UWB.Height + i[0]);//webbrower位置
            _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大小
            BSSZ(_UPt, _TPt, _UPs, _TPs);//设置大小
        }

        /// <summary>
        /// 窗口里大小和位置定位
        /// </summary>
        /// <param name="TSI"></param>
        /// <param name="TY"></param>
        public void BSSZ(Point? UTY, Point? TTY, Size? UTS, Size? TTS)
        {
            CWB(UTY, UTS); TopWBF11(TTY, TTS);
        }

        /// <summary>
        /// 里面的webbrower修改大小
        /// </summary>
        /// <param name="TY"></param>
        /// <param name="_UBP"></param>
        public void CWB(Point? TY, Size? _UBP)
        {
            int i; List<WebBrowser> _UL = this._UBF._UBL; WebBrowser _UWB;
            for (i = 0; i < _UL.Count; i++)
            {
                _UWB = _UL[i];
                FVCBrower.ChangeBrower(_UWB, TY, _UBP, true);
            }
        }

        /// <summary>
        /// 头部F11设置 
        /// </summary>
        /// <param name="_TopBL"></param>
        /// <param name="_ts"></param>
        private void TopWBF11(Point? _TopBL, Size? _ts)
        {
            FVCBrower.ChangeBrower((WebBrowser)_UBF._UWB, _TopBL, _ts, false);
        }

        /// <summary>
        /// 全屏后鼠标移动效果
        /// </summary>
        /// <param name="TF"></param>
        public void WYDC(bool TF)
        {
            WebBrowser _TopWB = _UBF._UWB;
            if (_TopWB.Location.Y == -35) if (TF) _TopWB.BringToFront(); else _TopWB.SendToBack();
        }

        #endregion

        #region  窗口拖动

        //窗体拖动
        [DllImport("user32.dll")]
        public static extern bool ReleaseCapture();//API函数
        public const int WM_SYSCOMMAND = 0x0112;//该变量表示将向Windows发送消息的类型
        public const int SC_MOVE = 0xF010;//该变量表示发送消息的附加消息
        public const int HTCAPTION = 0x0002;

        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
        static extern IntPtr PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
        static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);

        [DllImport("user32.dll", SetLastError = true)]
        static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);


        /// <summary>
        /// 拖动
        /// </summary>
        public void _Main_Drag()
        {
            ReleaseCapture();//该函数从当前线程中释放鼠标捕获事件，并恢复鼠标输入处理
            IntPtr _e = SendMessage(_UBF._UF.Handle, WM_SYSCOMMAND, (IntPtr)(SC_MOVE + HTCAPTION), IntPtr.Zero);
        }

        /// <summary>
        /// 窗体拖动后使用
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public void WBSJ(int x, int y)
        {
            IntPtr handle = _UBF._UWB.Handle;
            StringBuilder className = new StringBuilder(100);
            while (className.ToString() != "Internet Explorer_Server")
            {
                handle = GetWindow(handle, 5);
                GetClassName(handle, className, className.Capacity);
            }
            const uint upCode = 0x202;
            PostMessage(handle, upCode, IntPtr.Zero, (IntPtr)((y << 16) | x));
        }


        #endregion

        #region 没用的函数
        //public string AddFV(string FVC, string FVH, string CID, string UID)
        //{
        //    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 + "'}");
        //    return a;
        //}


        /// <summary>
        /// 一直全屏z
        /// </summary>
        //public void YZQP(Point? WZ)
        //{
        //    Form _UF = _UBF._UF; List<WebBrowser> _WL = _UBF._UBL; WebBrowser _TWB; int i;
        //    _UF.WindowState = FormWindowState.Maximized;
        //    if (WZ != null)
        //    {
        //        for (i = 0; i < _WL.Count; i++)
        //        {
        //            if ((_TWB = _WL[i]).Visible == false) continue;
        //            FVCBrower.ChangeBrower(_TWB, WZ, new Size(_TWB.Width, _UBF._UF.Height - 4), true);
        //        }
        //    }
        //}

        //        /// <summary>e
        ///// 响应web对form的请求
        ///// </summary>
        //[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
        //[System.Runtime.InteropServices.ComVisibleAttribute(true)]

        //private BrowserDAO _browserDao;
        //private FVCBrower _fvcBrower;
        //bool fullScreen = false; //设置窗体一开始的状态
        ///// <summary>
        ///// 构造函数
        ///// </summary>
        ///// <param name="webBrowser">请求的WebBrowser</param>
        ///// <param name="form">窗体</param>
        //public RespondWeb(BrowserDAO broDao, FVCBrower FB)
        //{
        //    this._browserDao = broDao;
        //    this._fvcBrower = FB;
        //    try
        //    {
        //        this._browserDao._webBrowser.ObjectForScripting = this;
        //    }
        //    catch (Exception e)
        //    {
        //        MessageBox.Show(e.ToString(), "错误");
        //    }
        //}

        ////打开添加收藏控件窗体
        //public void OpenAddFVC(int i)
        //{
        //    WebBrowser BL = (WebBrowser)_browserDao.BrowserList[i];
        //    _fvcBrower.OpenAddFVC(BL);
        //}
        ////打开收藏列表
        //public void OpenFV()
        //{
        //    _fvcBrower.OpenFV();
        //}

        ///*被动对主窗体的动作*/
        ////新建窗体
        //public void AddABrowser(string url, string name)
        //{
        //    _browserDao.AddBrowser(url, name);
        //    //if (WaitWebPageLoad((WebBrowser)_browserDao.BrowserList[_browserDao.BrowserList.Count - 1]))
        //    //string name = ((WebBrowser)_browserDao.BrowserList[_browserDao.BrowserList.Count - 1]).Name;
        //    //return _browserDao.BrowserToJson(name);
        //}

        ////载入网址
        //public void LoadUrl(string url, string name)
        //{
        //    _browserDao.ModifyOneBrowser(name, url);
        //}

        ////上一页
        //public void Previous(string name)
        //{
        //    _browserDao.FindBrowser(name).GoBack();
        //}

        ////下一页
        //public void Next(string name)
        //{
        //    _browserDao.FindBrowser(name).GoForward();
        //}

        ////刷新
        //public void Refresh(string name)
        //{
        //    _browserDao.FindBrowser(name).Refresh();
        //}

        ////加载主页
        //public void LoadHome(string name)
        //{
        //    this.LoadUrl(System.IO.Path.GetFullPath("html/blank.html"), name);
        //}

        ////设置
        //public void Setup()
        //{
        //    //StaticClass.LoadUrl = System.IO.Path.GetFullPath("html/setting.html");
        //    StaticClass.urlType = "setting";
        //    this.NewForm(System.IO.Path.GetFullPath("html/setting.html"));
        //}

        ////停止加载
        //public void Stop(string name)
        //{
        //    _browserDao.FindBrowser(name).Stop();
        //}

        ////关闭一个浏览器控件
        //public bool CloseOneBrowser(string name)
        //{
        //    _browserDao.CloseOneBrowser(name);
        //    return true;
        //}

        ////最大化
        //public void FormMaximized()
        //{
        //    if (this._browserDao.form.WindowState == FormWindowState.Normal)
        //    {
        //        this._browserDao.form.WindowState = FormWindowState.Maximized;
        //    }
        //    else if (this._browserDao.form.WindowState == FormWindowState.Maximized)
        //    {
        //        this._browserDao.form.WindowState = FormWindowState.Normal;
        //    }
        //}

        ////最小化
        //public void FormMinimized()
        //{
        //    this._browserDao.form.WindowState = FormWindowState.Minimized;
        //}

        ////关闭窗体
        //public void CloseForm()
        //{
        //    //this._browserDao.form.Close();
        //    this._browserDao.form.Hide();
        //}
        ////新建窗体
        //public void NewForm(string url)
        //{
        //    StaticClass.LoadUrl = url;
        //    StaticClass.getInstance();
        //}


        ///// <summary>
        ///// 设置可见，将选中的browser可见，其余隐藏
        ///// </summary>
        ///// <param name="name"></param>
        //public bool SetVisible(String name)
        //{
        //    WebBrowser WB = new WebBrowser();
        //    try
        //    {
        //        foreach (WebBrowser wb in _browserDao.BrowserList)
        //        {
        //            wb.Visible = false;
        //            if (wb.Name == name)
        //            {
        //                wb.Visible = true;
        //                WB = wb;
        //                continue;
        //            }
        //        }

        //    }
        //    catch { Thread.Sleep(150); WB.Document.Focus(); }
        //    return true;
        //}
        //public static void SetTimeout(double interval, Action action)
        //{
        //    System.Timers.Timer timer = new System.Timers.Timer(interval);
        //    timer.Elapsed += delegate(object sender, System.Timers.ElapsedEventArgs e)
        //     {
        //         timer.Enabled = false;
        //         action();
        //     };
        //    timer.Enabled = true;
        //}
        ///// <summary>
        ///// 右键菜单
        ///// </summary>
        ////public void ContextMenuStrip(string name)
        ////{
        ////    this._browserDao._broStrip.Show(1);
        ////    this._browserDao._broStrip._respndStrip._borwserName = name;
        ////}

        ///// <summary>
        ///// 隐藏右键菜单
        ///// </summary>
        ////public void HiddenContextMenuStrip()
        ////{
        ////    this._browserDao._broStrip.Hidden();
        ////}
        ////窗体变大
        //public void Larger()
        //{
        //    fullScreen = !fullScreen;
        //    if (fullScreen)
        //    {
        //        this._browserDao.form.DesktopBounds = System.Windows.Forms.Screen.GetWorkingArea(new Point(0, 0));//获取或设置window桌面上的的大小和位置
        //    }
        //    else
        //    {
        //        this._browserDao.form.Location = new Point(100, 100);//设置窗体变小之后位置
        //        this._browserDao.form.Size = new Size(1064, 600);//设置窗体变小之后大小
        //    }
        //}
        //public void FullScreen()
        //{
        //    if (this._browserDao.form.WindowState == FormWindowState.Normal)
        //    {
        //        this._browserDao.form.FormBorderStyle = FormBorderStyle.None;
        //        this._browserDao.form.WindowState = FormWindowState.Maximized;
        //    }
        //    else if (this._browserDao.form.WindowState == FormWindowState.Maximized)
        //    {
        //        if (this._browserDao.form.FormBorderStyle == FormBorderStyle.Sizable)
        //        {
        //            this._browserDao.form.FormBorderStyle = FormBorderStyle.None;
        //            this._browserDao.form.WindowState = FormWindowState.Normal;
        //            this._browserDao.form.WindowState = FormWindowState.Maximized;

        //        }
        //        else
        //        {
        //            this._browserDao.form.FormBorderStyle = FormBorderStyle.Sizable;
        //            this._browserDao.form.WindowState = FormWindowState.Normal;
        //        }
        //    }
        //}//全屏
        //public void BigScreen()
        //{
        //    int i;
        //    WebBrowser temp = new WebBrowser();
        //    Button _Quit = new Button();
        //    temp = (WebBrowser)US.Browser.IE.USMain.formList[0].Controls.Find("USBrowserNav", true)[0];//获取窗体上的控件
        //    temp.MinimumSize = new Size(1064, 0);
        //    temp.Size = new Size(1064, 0);
        //    for (i = 0; i < _browserDao.BrowserList.Count; i++)
        //    {
        //        WebBrowser a = new WebBrowser();
        //        a = (WebBrowser)_browserDao.BrowserList[i];
        //        a.Location = new Point(0, 0);
        //        a.Size = new Size(1064, a.Size.Height + 65);
        //    }
        //    FullScreen();
        //    //_Quit.Location = new Point(0, 0);
        //    //_Quit.Visible = true;
        //}//只显示网页的部分，上面的WebBrowser不要了


        ////窗体拖动
        //[DllImport("user32.dll")]
        //public static extern bool ReleaseCapture();//API函数
        //[DllImport("user32.dll")]
        //public static extern bool SendMessage(IntPtr hwdn, int wMsg, int mParam, int lParam);//接受发送来的消息 并处理

        //public const int WM_SYSCOMMAND = 0x0112;//该变量表示将向Windows发送消息的类型
        //public const int SC_MOVE = 0xF010;//该变量表示发送消息的附加消息
        //public const int HTCAPTION = 0x0002;

        //public void _Main_Drag()
        //{
        //    ReleaseCapture();//该函数从当前线程中释放鼠标捕获事件，并恢复鼠标输入处理
        //    SendMessage(this._browserDao.form.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
        //}

        #endregion
    }
}
