Behavior of WebBrowser Control

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
 
J

Jesse Houwing

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...
 
M

Michael Groeger

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top