Hi,
I'm trying to add panels to a parent panel programatically. I'd like them to
all take up an equal amount of the parent form as it's resized etc. Using
Docking::Fill obviously causes one panel to expand to fill the entire
parent, and I can't get a satisfactory result using Anchor - the leftmost
controls start to take more than their fair share as the parent panel grows
in size.. Can anyone suggest a way of doing this? Some kind of grid system
is what I'm looking for I guess. I could achieve this effect with custom
resizing code but I don't want to have to do that if avoidable.
Thanks in advance,
Steve 8 1855
"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> a écrit dans le message
de news:en***************@TK2MSFTNGP11.phx.gbl... Hi,
I'm trying to add panels to a parent panel programatically. I'd like them
to all take up an equal amount of the parent form as it's resized etc. Using Docking::Fill obviously causes one panel to expand to fill the entire parent, and I can't get a satisfactory result using Anchor - the leftmost controls start to take more than their fair share as the parent panel
grows in size.. Can anyone suggest a way of doing this? Some kind of grid system is what I'm looking for I guess. I could achieve this effect with custom resizing code but I don't want to have to do that if avoidable.
I think that Resize is the only way.
Nevertheless, it doesn't use much lines of code :
private void resize(object sender, EventArgs e)
{
// I have 4 panels, and I want each of them in a corner, and also to take a
quarter of the screen
// L is Left, R right, T top and B bottom
/*********
* LT * RT *
*********
* LB * RB *
**********/
LTpanel.Location = new Point(0, 0);
LTpanel.Width = myPanel.ClientSize.Width / 2;
LTpanel.Height = myPanel.ClientSize.Height / 2;
LTpanel.Anchor = AnchorStyles.Left | AnchorStyles.Top;
RTpanel.Location = new Point(myPanel.ClientSize.Width / 2, 0);
RTpanel.Width = RTpanel.Parent.ClientSize.Width / 2;
RTpanel.Height = RTpanel.Parent.ClientSize.Height / 2;
RTpanel.Anchor = AnchorStyles.Right | AnchorStyles.Top;
LBpanel.Location = new Point(0, RTpanel.Parent.ClientSize.Height / 2);
LBpanel.Width = LBpanel.Parent.ClientSize.Width / 2;
LBpanel.Height = LBpanel.Parent.ClientSize.Height / 2;
LBpanel.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
RBpanel.Location = new Point(myPanel.ClientSize.Width / 2,
RTpanel.Parent.ClientSize.Height / 2);
RBpanel.Width = RBpanel.Parent.ClientSize.Width / 2;
RBpanel.Height = RBpanel.Parent.ClientSize.Height / 2;
RBpanel.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
}
"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> a écrit dans le message
de news:en***************@TK2MSFTNGP11.phx.gbl... Hi,
I'm trying to add panels to a parent panel programatically. I'd like them
to all take up an equal amount of the parent form as it's resized etc. Using Docking::Fill obviously causes one panel to expand to fill the entire parent, and I can't get a satisfactory result using Anchor - the leftmost controls start to take more than their fair share as the parent panel
grows in size.. Can anyone suggest a way of doing this? Some kind of grid system is what I'm looking for I guess. I could achieve this effect with custom resizing code but I don't want to have to do that if avoidable.
I think that Resize is the only way.
Nevertheless, it doesn't use much lines of code :
private void resize(object sender, EventArgs e)
{
// I have 4 panels, and I want each of them in a corner, and also to take a
quarter of the screen
// L is Left, R right, T top and B bottom
/*********
* LT * RT *
*********
* LB * RB *
**********/
LTpanel.Location = new Point(0, 0);
LTpanel.Width = myPanel.ClientSize.Width / 2;
LTpanel.Height = myPanel.ClientSize.Height / 2;
LTpanel.Anchor = AnchorStyles.Left | AnchorStyles.Top;
RTpanel.Location = new Point(myPanel.ClientSize.Width / 2, 0);
RTpanel.Width = RTpanel.Parent.ClientSize.Width / 2;
RTpanel.Height = RTpanel.Parent.ClientSize.Height / 2;
RTpanel.Anchor = AnchorStyles.Right | AnchorStyles.Top;
LBpanel.Location = new Point(0, RTpanel.Parent.ClientSize.Height / 2);
LBpanel.Width = LBpanel.Parent.ClientSize.Width / 2;
LBpanel.Height = LBpanel.Parent.ClientSize.Height / 2;
LBpanel.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
RBpanel.Location = new Point(myPanel.ClientSize.Width / 2,
RTpanel.Parent.ClientSize.Height / 2);
RBpanel.Width = RBpanel.Parent.ClientSize.Width / 2;
RBpanel.Height = RBpanel.Parent.ClientSize.Height / 2;
RBpanel.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
}
Hi,
Yeah, but when you've got 'n' panels, it becomes harder. I'm going to have
to write a custom layout event handler I think.
Thanks for the reply,
Steve
"Mathieu Chavoutier" <No****@NoSpam.org> wrote in message
news:OG**************@TK2MSFTNGP10.phx.gbl... "Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> a écrit dans le message de news:en***************@TK2MSFTNGP11.phx.gbl... Hi,
I'm trying to add panels to a parent panel programatically. I'd like
them to all take up an equal amount of the parent form as it's resized etc.
Using Docking::Fill obviously causes one panel to expand to fill the entire parent, and I can't get a satisfactory result using Anchor - the
leftmost controls start to take more than their fair share as the parent panel grows in size.. Can anyone suggest a way of doing this? Some kind of grid
system is what I'm looking for I guess. I could achieve this effect with custom resizing code but I don't want to have to do that if avoidable.
I think that Resize is the only way. Nevertheless, it doesn't use much lines of code :
private void resize(object sender, EventArgs e)
{
// I have 4 panels, and I want each of them in a corner, and also to take
a quarter of the screen
// L is Left, R right, T top and B bottom
/*********
* LT * RT *
*********
* LB * RB *
**********/
LTpanel.Location = new Point(0, 0);
LTpanel.Width = myPanel.ClientSize.Width / 2;
LTpanel.Height = myPanel.ClientSize.Height / 2;
LTpanel.Anchor = AnchorStyles.Left | AnchorStyles.Top;
RTpanel.Location = new Point(myPanel.ClientSize.Width / 2, 0);
RTpanel.Width = RTpanel.Parent.ClientSize.Width / 2;
RTpanel.Height = RTpanel.Parent.ClientSize.Height / 2;
RTpanel.Anchor = AnchorStyles.Right | AnchorStyles.Top;
LBpanel.Location = new Point(0, RTpanel.Parent.ClientSize.Height / 2);
LBpanel.Width = LBpanel.Parent.ClientSize.Width / 2;
LBpanel.Height = LBpanel.Parent.ClientSize.Height / 2;
LBpanel.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
RBpanel.Location = new Point(myPanel.ClientSize.Width / 2, RTpanel.Parent.ClientSize.Height / 2);
RBpanel.Width = RBpanel.Parent.ClientSize.Width / 2;
RBpanel.Height = RBpanel.Parent.ClientSize.Height / 2;
RBpanel.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
}
Hi,
Yeah, but when you've got 'n' panels, it becomes harder. I'm going to have
to write a custom layout event handler I think.
Thanks for the reply,
Steve
"Mathieu Chavoutier" <No****@NoSpam.org> wrote in message
news:OG**************@TK2MSFTNGP10.phx.gbl... "Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> a écrit dans le message de news:en***************@TK2MSFTNGP11.phx.gbl... Hi,
I'm trying to add panels to a parent panel programatically. I'd like
them to all take up an equal amount of the parent form as it's resized etc.
Using Docking::Fill obviously causes one panel to expand to fill the entire parent, and I can't get a satisfactory result using Anchor - the
leftmost controls start to take more than their fair share as the parent panel grows in size.. Can anyone suggest a way of doing this? Some kind of grid
system is what I'm looking for I guess. I could achieve this effect with custom resizing code but I don't want to have to do that if avoidable.
I think that Resize is the only way. Nevertheless, it doesn't use much lines of code :
private void resize(object sender, EventArgs e)
{
// I have 4 panels, and I want each of them in a corner, and also to take
a quarter of the screen
// L is Left, R right, T top and B bottom
/*********
* LT * RT *
*********
* LB * RB *
**********/
LTpanel.Location = new Point(0, 0);
LTpanel.Width = myPanel.ClientSize.Width / 2;
LTpanel.Height = myPanel.ClientSize.Height / 2;
LTpanel.Anchor = AnchorStyles.Left | AnchorStyles.Top;
RTpanel.Location = new Point(myPanel.ClientSize.Width / 2, 0);
RTpanel.Width = RTpanel.Parent.ClientSize.Width / 2;
RTpanel.Height = RTpanel.Parent.ClientSize.Height / 2;
RTpanel.Anchor = AnchorStyles.Right | AnchorStyles.Top;
LBpanel.Location = new Point(0, RTpanel.Parent.ClientSize.Height / 2);
LBpanel.Width = LBpanel.Parent.ClientSize.Width / 2;
LBpanel.Height = LBpanel.Parent.ClientSize.Height / 2;
LBpanel.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
RBpanel.Location = new Point(myPanel.ClientSize.Width / 2, RTpanel.Parent.ClientSize.Height / 2);
RBpanel.Width = RBpanel.Parent.ClientSize.Width / 2;
RBpanel.Height = RBpanel.Parent.ClientSize.Height / 2;
RBpanel.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
}
"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> a écrit dans le message
de news:ef*************@TK2MSFTNGP11.phx.gbl... Hi,
Yeah, but when you've got 'n' panels, it becomes harder. I'm going to have to write a custom layout event handler I think.
Perhaps, if you have a list of Panels, you can do a list, and loop
while (elements_in_the_list)
{
LTpanel.Location = new Point(x * myPanel.ClientSize.Width / N, x *
myPanel.ClientSize.Height / N);
LTpanel.Width = myPanel.ClientSize.Width / N;
LTpanel.Height = myPanel.ClientSize.Height / N;
x++;
}
And, if it's not only panels, you will have litte changes to do :o)
Hope that help.
"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> a écrit dans le message
de news:ef*************@TK2MSFTNGP11.phx.gbl... Hi,
Yeah, but when you've got 'n' panels, it becomes harder. I'm going to have to write a custom layout event handler I think.
Perhaps, if you have a list of Panels, you can do a list, and loop
while (elements_in_the_list)
{
LTpanel.Location = new Point(x * myPanel.ClientSize.Width / N, x *
myPanel.ClientSize.Height / N);
LTpanel.Width = myPanel.ClientSize.Width / N;
LTpanel.Height = myPanel.ClientSize.Height / N;
x++;
}
And, if it's not only panels, you will have litte changes to do :o)
Hope that help.
Hi,
Yeah, I've done a system like that as a layout handler and it seems to work
fine. Thanks!
Steve
"Mathieu Chavoutier" <No****@NoSpam.org> wrote in message
news:eQ**************@TK2MSFTNGP12.phx.gbl... "Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> a écrit dans le message de news:ef*************@TK2MSFTNGP11.phx.gbl... Hi,
Yeah, but when you've got 'n' panels, it becomes harder. I'm going to
have to write a custom layout event handler I think.
Perhaps, if you have a list of Panels, you can do a list, and loop
while (elements_in_the_list) { LTpanel.Location = new Point(x * myPanel.ClientSize.Width / N, x * myPanel.ClientSize.Height / N); LTpanel.Width = myPanel.ClientSize.Width / N; LTpanel.Height = myPanel.ClientSize.Height / N; x++; }
And, if it's not only panels, you will have litte changes to do :o)
Hope that help.
Hi,
Yeah, I've done a system like that as a layout handler and it seems to work
fine. Thanks!
Steve
"Mathieu Chavoutier" <No****@NoSpam.org> wrote in message
news:eQ**************@TK2MSFTNGP12.phx.gbl... "Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> a écrit dans le message de news:ef*************@TK2MSFTNGP11.phx.gbl... Hi,
Yeah, but when you've got 'n' panels, it becomes harder. I'm going to
have to write a custom layout event handler I think.
Perhaps, if you have a list of Panels, you can do a list, and loop
while (elements_in_the_list) { LTpanel.Location = new Point(x * myPanel.ClientSize.Width / N, x * myPanel.ClientSize.Height / N); LTpanel.Width = myPanel.ClientSize.Width / N; LTpanel.Height = myPanel.ClientSize.Height / N; x++; }
And, if it's not only panels, you will have litte changes to do :o)
Hope that help.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Roland Simon |
last post by:
I'm developing an app with several modules an lots of different windows shown
in the fashion of windows explorer / outlook.
To the left is a list view control, to the right the user can view or...
|
by: Josh Handel |
last post by:
I am working on a fairly complex GUI and I have a problem.. I have
several forms that work togeather to make up a Single UI. Here is my
problem.. How do I make it so that when any one form is...
|
by: Kerry Sanders |
last post by:
I was playing around with a new Windows form yesterday. I wanted to drop two
panels on the form. The first would be set Dock=Top. The second would be set
Dock=Fill.
So, I dropped the first...
|
by: BBM |
last post by:
I'm trying to set up a form with two panels divided by a Splitter control.
I can make the Splitter work in the situations described in the documentation (Listbox or TreeView on left w/Dock set to...
|
by: conset23 |
last post by:
Hello.
I'm working with WinForm. It has 30 same user control, each with 4 buttons,
3 labels, 3 textboxes, 2 picture boxes and uses override onPaint to draw
gradient rectangle. Main form also has 2...
| |
by: Ronchese |
last post by:
Hi All,
I 'm doing a form that have two dockable panels, one at top and other at
left (for sample).
The user can double-clicks the panels and they become floating, which
double-clicked again,...
|
by: Steve McLellan |
last post by:
Hi,
I'm trying to add panels to a parent panel programatically. I'd like them to
all take up an equal amount of the parent form as it's resized etc. Using
Docking::Fill obviously causes one...
|
by: Joe |
last post by:
I'm creating a C# application, and want to use docking windows. However,
I want the docking windows to look like the docking windows withing
VS2005, with a title bar, close button, etc... When...
|
by: shahoo |
last post by:
Hi,
can anyone tell me please how can I create a docking panel in C# (Like
the toolbox in VS.NET 2005).
Thanks In advance
|
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,...
|
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...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
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...
|
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...
|
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 ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |