IntPtr handle = webBrowser.Handle;
            StringBuilder className = new StringBuilder(100);
            while (className.ToString() != "Internet Explorer_Server") // The class control for the browser 
            {
                handle = GetWindow(handle, 5); // Get a handle to the child window 
                GetClassName(handle, className, className.Capacity);
            }
            //handle 表示浏览器的句柄
            Graphics g = Graphics.FromHwnd(handle);
            IntPtr dc;
            dc = g.GetHdc();//此时失败。
            同样的代码在botton的click事件中执行是正确的。