Behavior of WebBrowser Control

  • Thread starter Thread starter Michael Groeger
  • Start date Start date
M

Michael Groeger

Hi,

I am trying to create a control which adds rounded borders to the WebBrowser
Control. The content of the WebBrowser control should be visible inside of
the round borders, outside of the borders the background should be white.

I tried to achieve this on several ways:
- subclass WebBrowser control:
Add a round border in OnPaint. Draw white background in OnPaint outside of
the round border.
=> Does not work, WebBrowser control always overpaints its contents over
everything the inherited control paints itself.

- overlay WebBrowser control:
Add an instance to the form. Create a Control with round borders, which
supports transparency inside of the border and draws a white background
outside of the border. Add an instance of this control to the form with the
same size and position as the WebBrowser control's instance. Ensure that it
is on-top of the WebBrowser control's instance.
=> Does not work. The WebBrowser control seems to draw its content directly
"on screen" and not into the control.

Does somebody have an idea how to solve this?

Regards,
Michael
 
Hello Michael,
Hi,

I am trying to create a control which adds rounded borders to the
WebBrowser Control. The content of the WebBrowser control should be
visible inside of the round borders, outside of the borders the
background should be white.

I tried to achieve this on several ways:
- subclass WebBrowser control:
Add a round border in OnPaint. Draw white background in OnPaint
outside of
the round border.
=> Does not work, WebBrowser control always overpaints its contents
over
everything the inherited control paints itself.
- overlay WebBrowser control:
Add an instance to the form. Create a Control with round borders,
which
supports transparency inside of the border and draws a white
background
outside of the border. Add an instance of this control to the form
with the
same size and position as the WebBrowser control's instance. Ensure
that it
is on-top of the WebBrowser control's instance.
=> Does not work. The WebBrowser control seems to draw its content
directly
"on screen" and not into the control.
Does somebody have an idea how to solve this?

Do you have full control over the contents of the browser control? I mean,
it's pretty easy to add rounded borders to the content of the control, instead
of trying to paint over the embedded Internet Explorer instance.

Another option would be to draw the rounded corners and have a bit of a margin
in which the webbrowser control is placed. Not ideal, but it should work...
 
Thanks for your reply Jesse!
Do you have full control over the contents of the browser control? I mean,
it's pretty easy to add rounded borders to the content of the control, instead
of trying to paint over the embedded Internet Explorer instance.

Unfortunately not. The content displayed is provided by a other company.
Another option would be to draw the rounded corners and have a bit of a margin
in which the webbrowser control is placed. Not ideal, but it should work...

The content should expand to the area inside the rounded borders. But this
maybe an option to discuss.

Regards,
Michael
 
Back
Top