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 1849
"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: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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: 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,...
|
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...
| |