How to run time modify webbrowser location / size

B

Boki

Hi All,

When put in a webbowser box into form, there is no adjustable anchor
for user to adjust size if he/she want.

I use an external Hscroll for adjustment.

The problem is I have two webbrowser box inside same form, I need to
change their location in run time.

but it can't pass complie:

webBrowser2.Location.X = webBrowser1.Width + 5;


Thanks.
Boki.
 
P

Pavel Minaev

Hi All,

When put in a webbowser box into form, there is no adjustable anchor
for user to adjust size if he/she want.

I use an external Hscroll for adjustment.

The problem is I have two webbrowser box inside same form, I need to
change their location in run time.

but it can't pass complie:

  webBrowser2.Location.X = webBrowser1.Width + 5;

It's not related to the control being a WebBrowser - the above line
wouldn't compile for any control. This is because Location is of type
Point, and that type has both X and Y as read-only fields (it's a
struct, and structs are generally supposed to be immutable). So you
can't change fields individually, but you can change Location as a
whole. For example:

webBrowser2.Location = new Point(webBrowser1.Width + 5,
webBrowser2.Location.Y);
 
F

Family Tree Mike

I'm not sure what you mean by there not being an anchor to adjust the size.
It sounds like you could place a splitter panel in the ui, with one
webbrowser in each splitter panel. They can be docked or anchord, and move
with the split movement. This panel can be docked to your form, and resize
appropriately when the form resizes.
 
B

Boki

It's not related to the control being a WebBrowser - the above line
wouldn't compile for any control. This is because Location is of type
Point, and that type has both X and Y as read-only fields (it's a
struct, and structs are generally supposed to be immutable). So you
can't change fields individually, but you can change Location as a
whole. For example:

  webBrowser2.Location = new Point(webBrowser1.Width + 5,
webBrowser2.Location.Y);

You provided what I need, thank you!

Boki.
 

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