This time in a Delphi interface to open the function of the Web page, and this page is in the window can be fully displayed, can be reduced to another window on the panel display
However, when you change the window of the page, the WebBrowser control becomes blank.
Google on the internet for half a day, finally found on the CSDN solution:
Original address: http://bbs.csdn.NET/topics/200046109
[Delphi]View PlainCopy
- Uses
- SHDocVw, Windows, Controls, Forms, Classes;
- Type
- Tmywebbrowser = Class (Twebbrowser)
- Private
- protected
- Actualhandle:hwnd;
- procedure Createwnd; override;
- procedure Destroywnd; override;
- Public
- end;
- {Tmywebbrowser}
- Procedure Tmywebbrowser. Createwnd;
- Begin
- if (Actualhandle <> 0) and IsWindow (actualhandle) Then
- begin
- WindowHandle: = Actualhandle;
- Actualhandle: = 0;
- Windows. SetParent (WindowHandle, Twincontrol (self). Parent. Handle);
- //force A resize on the client window
- MoveWindow (WindowHandle, 0, 0, Twincontrol (self). Parent. Width,
- Twincontrol (self). Parent. Height, true);
- End
- Else
- inherited;
- End
- Procedure Tmywebbrowser. Destroywnd;
- Begin
- if (csdestroying in componentstate) Then
- inherited
- Else
- begin
- //parent to the application window which was 0x0 in size
- Windows. SetParent (WindowHandle, Forms. Application. Handle);
- //save the WindowHandle
- Actualhandle: = WindowHandle;
- //set it to 0 so Createwnd'll be called again ...
- WindowHandle: = 0;
- end;
- End
http://blog.csdn.net/youthon/article/details/8450610
The webbrowser of the parent in Delphi becomes a blank problem resolution (covering Createwnd and Destroywnd)