Delphi Xe2 VCL style and webbrowser

2019-07-06 22:40发布

问题:

Win7 x64, Delphi Xe2 update2

Prompt:

  1. The new project, compile as x32, are applied visual (vcl) styles in the project options, by default one is chosen
  2. On the form the button1 and WebBrowser1
  3. In the button we write WebBrowser1.Navigate ('http://google.com');
  4. We start, we press the button - in a browser we see a site google.com, all ок

We compile as x64, it is started ок, by button pressing we receive an error "float division on zerro".

Questions:

  1. At all so (error)? And as with it to struggle? (in x64 mode)
  2. How to apply visual style to strips of scrolling WebBrowser1? (in x32 mode) :( a native component could not skin, but AlphaControls Skin system - work ok, and webbrowser scrolling lines skinned normal

p.s. update3 yet did not put

p.s.s. bad english: on

回答1:

This can be done subclassing the TWebBrowser component and handling these events

OnDocumentComplete
OnNavigateComplete2
OnBeforeNavigate2
OnCommandStateChange
OnProgressChange

plus the WM_SIZE windows message.

The key is use the TScrollbar component and a Twincontrol as container to overlap the original webbrowser scrollbars.

I just wrote an article which explains in depth how this can be implemented Delphi Vcl Styles and TWebBrowser



回答2:

VCL styles cannot be applied to TWebBrowser AFAIK. Its UI is controlled by Internet Explorer, not the VCL.