473,569 Members | 2,729 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Control Dock question

I am trying to put 2 controls in a page where I want the first control
to have 80% of the screen and the second control 20%. How can I do
that?

I used control property to set the first one to Top and the second one
to Bottom and is not working properly. I am loosing the first controls
bottom portion.

Any help please?

Thanks.

Mar 1 '07 #1
3 3985
PS

"DBC User" <db*****@gmail. comwrote in message
news:11******** **************@ v33g2000cwv.goo glegroups.com.. .
>I am trying to put 2 controls in a page where I want the first control
to have 80% of the screen and the second control 20%. How can I do
that?

I used control property to set the first one to Top and the second one
to Bottom and is not working properly. I am loosing the first controls
bottom portion.

Any help please?
One control needs to use DockStyle.Fill

Sample code:

Panel p1 = new Panel();
p1.BackColor = Color.Red;
p1.Width = this.Width / 5;
p1.Dock = DockStyle.Left;
Panel p2 = new Panel();
p2.BackColor = Color.Blue;
p2.Dock = DockStyle.Fill;
this.Controls.A dd(p1);
this.Controls.A dd(p2);

PS
>
Thanks.

Mar 1 '07 #2
PS

"PS" <ec***********@ hotmail.comwrot e in message
news:A1JFh.3263 3$kr6.26262@trn dny09...
>
"DBC User" <db*****@gmail. comwrote in message
news:11******** **************@ v33g2000cwv.goo glegroups.com.. .
>>I am trying to put 2 controls in a page where I want the first control
to have 80% of the screen and the second control 20%. How can I do
that?

I used control property to set the first one to Top and the second one
to Bottom and is not working properly. I am loosing the first controls
bottom portion.

Any help please?

One control needs to use DockStyle.Fill

Sample code:

Panel p1 = new Panel();
p1.BackColor = Color.Red;
p1.Width = this.Width / 5;
p1.Dock = DockStyle.Left;
Panel p2 = new Panel();
p2.BackColor = Color.Blue;
p2.Dock = DockStyle.Fill;
this.Controls.A dd(p1);
this.Controls.A dd(p2);
Add them in the reverse order or add p2.BringToFront () at end. The order in
which you add controls has an effect when one is "Fill".
>
PS
>>
Thanks.


Mar 1 '07 #3
On Mar 1, 5:12 pm, "PS" <ecneserpeg...@ hotmail.comwrot e:
"PS" <ecneserpeg...@ hotmail.comwrot e in message

news:A1JFh.3263 3$kr6.26262@trn dny09...


"DBC User" <dbcu...@gmail. comwrote in message
news:11******** **************@ v33g2000cwv.goo glegroups.com.. .
>I am trying to put 2 controls in a page where I want the first control
to have 80% of the screen and the second control 20%. How can I do
that?
I used control property to set the first one to Top and the second one
to Bottom and is not working properly. I am loosing the first controls
bottom portion.
Any help please?
One control needs to use DockStyle.Fill
Sample code:
Panel p1 = new Panel();
p1.BackColor = Color.Red;
p1.Width = this.Width / 5;
p1.Dock = DockStyle.Left;
Panel p2 = new Panel();
p2.BackColor = Color.Blue;
p2.Dock = DockStyle.Fill;
this.Controls.A dd(p1);
this.Controls.A dd(p2);

Add them in the reverse order or add p2.BringToFront () at end. The order in
which you add controls has an effect when one is "Fill".


PS
Thanks.- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -
Thanks for the help. Its what I was looking for.

Mar 6 '07 #4

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

Similar topics

8
1590
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.
3
1347
by: Dariusz Rajtak | last post by:
Hello, I have to create my own control which might be an extension for a standard 'panel' control. I called it 'SmartPanel'. This is specialized panel. It consists of a title bar and a client area on which other controls can be placed. Depends on its state, it can shrink into one of its borders so only title bar is visible in shrinked...
3
1566
by: meh | last post by:
Hi All; After creating a new tab if I delete the tab I cannot close my app from the X in the upper right of the window. NE1 have a clue why. Tried stepping through the delete seems to work fine but I can not close the app?????? I am creating a new Tab this way..... ElseIf e.Button Is tbNewVol Then
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...
17
7391
by: Kbalz | last post by:
I'm developing a Wizard type program, and I'm flipping between steps by using a TabControl.. buttons on each tabPage move to the next or previous tabPage. When I press CTRL+Tab however, the tabControl begins to cycle through the tabPages, just as it does in Visual Studio, IE7 etc.. any tabbed program. I need this blocked.
7
5214
by: Zytan | last post by:
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/library/a08t4ke7(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...
12
6396
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.
3
3141
by: XJ | last post by:
Hi Expert, i'm doing some program for my project which using WPF, to create my application more managible i would apply "user control" concept for my project for each section of my workspace. to make my workspace more flexible, all the "namespace" and "user control" name will store into DB, once user launch my application, base on...
0
1949
by: \Ji Zhou [MSFT]\ | last post by:
Hello Ashutosh, I see your points. As to your two new concerns, I am give the detailed comments in the following. 1. Is it possible to achieve this result without calling Update on the route table? I want to give the user an option to save/reject the changes. Yes, we can achieve the objective without calling the Update function on the...
0
7694
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7609
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...
0
7964
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...
0
6278
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...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
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...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
936
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...

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.