473,657 Members | 2,591 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

control's Dock property = Fill: fills entire form regardless of other 'Dock's.

I just wanted a little practice with the WebBrowser control, so I did
the VB guided tour example here in C#:
http://msdn2.microsoft.com/en-us/lib...e7(VS.80).aspx
The tutorial asks to put a Panel with a Button and TextBox in it, and
a WebBrowser below it. Then, it sets the Panel's Dock property to be
Top. It sets the WebBroswer's Dock property to be Fill.

But, the WebBrowser then fills the entire form! Even though the
Panel's Dock property is already using the top of the form. I did
this example in VB some time ago, and this did not occur. Is this a
bug? Does C# handle this differently? I would assume Dock implies
like a docking toolbar, no two can occupy the same space.

It takes 1 minute to test this out, so please do if you have time.
You can see the error occurs right within the form designer, before
any code is written.

Zytan

Mar 21 '07 #1
7 5217
On Mar 21, 12:27 pm, "Zytan" <zytanlith...@y ahoo.comwrote:
I just wanted a little practice with the WebBrowser control, so I did
the VB guided tour example here in C#:http://msdn2.microsoft.com/en-us/lib...e7(VS.80).aspx
The tutorial asks to put a Panel with a Button and TextBox in it, and
a WebBrowser below it. Then, it sets the Panel's Dock property to be
Top. It sets the WebBroswer's Dock property to be Fill.

But, the WebBrowser then fills the entire form! Even though the
Panel's Dock property is already using the top of the form. I did
this example in VB some time ago, and this did not occur. Is this a
bug? Does C# handle this differently? I would assume Dock implies
like a docking toolbar, no two can occupy the same space.

It takes 1 minute to test this out, so please do if you have time.
You can see the error occurs right within the form designer, before
any code is written.

Zytan
Zytan,

I am pretty sure that the "Z" order of the controls determine which
control has priority over the space of your application. Try brining
the Panel to the top, you can right click it in the designer to do
this.

Along similar lines, when you have two items docked to "Top" the Z
order determines which is the topmost.

Cheers,

--Rob W

Mar 21 '07 #2
On Mar 21, 1:15 pm, "Rob Whiteside" <rob.whites...@ gmail.comwrote:
On Mar 21, 12:27 pm, "Zytan" <zytanlith...@y ahoo.comwrote:
I just wanted a little practice with the WebBrowser control, so I did
the VB guided tour example here in C#:http://msdn2.microsoft.com/en-us/lib...e7(VS.80).aspx
The tutorial asks to put a Panel with a Button and TextBox in it, and
a WebBrowser below it. Then, it sets the Panel's Dock property to be
Top. It sets the WebBroswer's Dock property to be Fill.
But, the WebBrowser then fills the entire form! Even though the
Panel's Dock property is already using the top of the form. I did
this example in VB some time ago, and this did not occur. Is this a
bug? Does C# handle this differently? I would assume Dock implies
like a docking toolbar, no two can occupy the same space.
It takes 1 minute to test this out, so please do if you have time.
You can see the error occurs right within the form designer, before
any code is written.
Zytan

Zytan,

I am pretty sure that the "Z" order of the controls determine which
control has priority over the space of your application. Try brining
the Panel to the top, you can right click it in the designer to do
this.

Along similar lines, when you have two items docked to "Top" the Z
order determines which is the topmost.

Cheers,

--Rob W
oops -
By "Bring panel to Top" I meant Bring to _Front_

Mar 21 '07 #3
I am pretty sure that the "Z" order of the controls determine which
control has priority over the space of your application. Try brining
the Panel to the top, you can right click it in the designer to do
this.
Ah, and I did make the Panel after the WebBrowser (unlike the order of
the tutorial), this is certainly the cause! And it totally makes
sense to have some sense of priority, which needs some kind of
criteria to be based on. And this would be it. Thanks, Rob!

Zytan

Mar 21 '07 #4
I am pretty sure that the "Z" order of the controls determine which
control has priority over the space of your application. Try brining
the Panel to the top, you can right click it in the designer to do
this.
Along similar lines, when you have two items docked to "Top" the Z
order determines which is the topmost.

oops -
By "Bring panel to Top" I meant Bring to _Front_
Changing the tab order doesn't change the Z. I am unsure how to
change the Z. I've tried right clicking and selecting "Bring to
Front" and "Send to Back", but this does nothing, either. I'll mess
some more, and see if I can find the solution (other than recreating
all the controls - there must be a better way).

Zytan

Mar 21 '07 #5
Changing the tab order doesn't change the Z. I am unsure how to
change the Z. I've tried right clicking and selecting "Bring to
Front" and "Send to Back", but this does nothing, either. I'll mess
some more, and see if I can find the solution (other than recreating
all the controls - there must be a better way).
How to: Define Z-Ordering of Docked ToolStrip Controls
http://msdn2.microsoft.com/en-us/lib...73(vs.80).aspx

The z-order is set in the order that you add the controls. So, I'll
have to modify the order of the this.Controls.A dd(...); in the
Form1.Designer. cs file. And YES, it works! :)

Zytan
Mar 21 '07 #6
On Mar 21, 2:01 pm, "Zytan" <zytanlith...@y ahoo.comwrote:
Changing the tab order doesn't change the Z. I am unsure how to
change the Z. I've tried right clicking and selecting "Bring to
Front" and "Send to Back", but this does nothing, either. I'll mess
some more, and see if I can find the solution (other than recreating
all the controls - there must be a better way).

How to: Define Z-Ordering of Docked ToolStrip Controlshttp://msdn2.microsoft .com/en-us/library/ms229673(vs.80) .aspx

The z-order is set in the order that you add the controls. So, I'll
have to modify the order of the this.Controls.A dd(...); in the
Form1.Designer. cs file. And YES, it works! :)

Zytan
Instead of modifying the Form1.Designer. cs file, you can right click
on the control in the Designer and choose "Bring to front" or "Send to
back". You can also call those methods programatically
(control.BringT oFront();)

--Rob W

Mar 21 '07 #7
Changing the tab order doesn't change the Z. I am unsure how to
change the Z. I've tried right clicking and selecting "Bring to
Front" and "Send to Back", but this does nothing, either. I'll mess
some more, and see if I can find the solution (other than recreating
all the controls - there must be a better way).
How to: Define Z-Ordering of Docked ToolStrip Controlshttp://msdn2.microsoft .com/en-us/library/ms229673(vs.80) .aspx
The z-order is set in the order that you add the controls. So, I'll
have to modify the order of the this.Controls.A dd(...); in the
Form1.Designer. cs file. And YES, it works! :)
Zytan

Instead of modifying the Form1.Designer. cs file, you can right click
on the control in the Designer and choose "Bring to front" or "Send to
back". You can also call those methods programatically
(control.BringT oFront();)
Yes, as you stated that before, and as you'll see quoted above, I
tried this, and it didn't work.

Although, I agree that it should have. I'll try it again. Strange,
it works now (I can see it modifying the order in the code).

You have to use "Bring to Front" for it to work, which adds the
control FIRST, which makes the other controls, which are added later,
dock first. (I would have thought it would be the other way around -
the first controls added have precedence, but it's not like that.)

I am unsure why your suggestion didn't work the first time. Perhaps
this is why: When changing the z-order, the controls are not
automatically rearranged. To see the results, you need to undock and
then redock. I think when I first tried your suggestion, I was
changing the Dock property, but not to 'none', insteaed to 'bottom',
and this wasn't good enough. You have to change it to 'none', and then
re-dock it to see the proper effect. So, that's a little bug in the
Form Designer.

Thanks again,

Zytan

Mar 22 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
1593
by: Yasutaka Ito | last post by:
Hi, Is there a way to find to which control the current control is docked against? For example, let's say I have panel1 and panel2 docked to left within a form. The panel1 is the first one on the left and the panel2 is the second one docked against panel1. I want to be able to find out to which control/form the specified panel.
17
6881
by: No One | last post by:
Is there a way to keep a control centered inside a form without having to recalculate everytime the form is resized?
4
1867
by: Derrick | last post by:
Hello all; I'm trying to simulate a "scrollable context menu". What I want is to have a listbox fill the entire area of a small form (with no border). Using the designer and property grid, I noticed that if I set the form size first, then try to copy and paste this value into the size of the listbox (making sure the listbox is in location 0,0 first), the designer won't let the listbox fill the entire form area - there are 9 pixels of...
1
1165
by: MrNobody | last post by:
I want to have a DataGrid that fills up the entire Window but does not slip underneath a StatusBar along the bottom... currently I first set Anchor to AnchorStyles.Bottom then the Dock to DockStyle.Fill. Upon resizing the window the DataGrid fills correctly but then the horizontal scrollbar along the button slips under my StatusBar, so you cannot see it anymore. If I switch the order of setting the Anchor and Dock, It results in a...
4
2239
by: Steve Amey | last post by:
Hi all I have a Form that is inherited from a main form. On the child form I am putting 2 panels directly on the form, not in any other controls. If I build the project, 1 of the panels decides to re-size itself, but the other one doesn't. Obviously, I don't want the panels re-sizing every time I perform a build. Has any-one encountered this behaviour at all? If I look at the code in the form, the size of the panel is correct, but...
5
2204
by: p19010101 | last post by:
I'm working on a single form app, the form contains a tab control with multiple pages. As a result the code gets very long in the code page, which can be a pain to maintain, basically it's a mess. What I'm planning to do is to break down the codes into separate modules, i.e. one module per tab page, and pass the controls to the module's subroutines as parameters. It should work but I think it's wrong, or at least not the .net way of...
1
1925
by: Lucien Dol | last post by:
Hi all, Can someone help me with this, please? I've got a user control that (amongst other controls) contains a textbox. The textbox has its Anchor property set to "Left, Top, Right", meaning that it will stretch automatically when the control is resized on a form or other user control. When in design mode I look at the control by itself (rather than dropped on a form) the control has a certain size (let's call this SizeA).
11
2866
by: herman404 | last post by:
Hi everyone, I have a DataGrid that displays data on a dialog application. When the dialog is resized, the datagrid keeps the same shape, We would need the datagrid to keep a relative shape compared to the rest of the dialog when the user resizes it. Any ideas on how to do this? Thanks!
12
6407
by: Rotsey | last post by:
Hi, I have not had a good answer to this question. I put a menustrip on a form and so it is a main menu in affect. Now I put a webbrowser control on the form and set it dock fill. Of course what happens is the menu covers the top of the webbrowser control which i do not want.
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7321
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1607
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.