473,327 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Panel w/ border help

I've got a custom Panel that draws a colored border for me. Works great,
however a new problem I've run into is this.

I have the custom panel, then I want to put another panel (just a
Windows.Forms.Panel) inside it, and dock it to the top. When i do this, the
docked panel paints over the border of the custom panel where it is docked,
so some of the left and right (the height of the child panel) and all of the
top.

How can I force my custom panel to draw on top of the child panels? Or is
there another solution?

Please help, I've been spinning my wheels on this for a while now!

Thanks!

Apr 6 '07 #1
4 1692
Oh yeah, I should mention I tried overriding DisplayRectangle and bringing
it in a few pixels, but that doesn't seem to do anything.
"Nathan Laff" <re******@hotmail.comwrote in message
news:2E**********************************@microsof t.com...
I've got a custom Panel that draws a colored border for me. Works great,
however a new problem I've run into is this.

I have the custom panel, then I want to put another panel (just a
Windows.Forms.Panel) inside it, and dock it to the top. When i do this,
the docked panel paints over the border of the custom panel where it is
docked, so some of the left and right (the height of the child panel) and
all of the top.

How can I force my custom panel to draw on top of the child panels? Or is
there another solution?

Please help, I've been spinning my wheels on this for a while now!

Thanks!
Apr 6 '07 #2
"Nathan Laff" <re******@hotmail.comwrote:
I've got a custom Panel that draws a colored border for me. Works
great, however a new problem I've run into is this.
I have the custom panel, then I want to put another panel (just a
Windows.Forms.Panel) inside it, and dock it to the top. When i do
this, the docked panel paints over the border of the custom panel
where it is docked, so some of the left and right (the height of the
child panel) and all of the top.
How can I force my custom panel to draw on top of the child panels?
Or is there another solution?
Could you set the panel's Padding so that docked child items avoid its
outer edge?

Eq.
Apr 6 '07 #3
Hi Nathan,

As Paul said, if you set the custom panel's Padding you should be able to prevent docking to cover the borders. Furthermore, overriding Paddingin the custom panel will help you prevent the user from manually covering the borders.

private const minpadding = 2;
public new Padding Padding
{
get { return base.Padding; }
set
{
int l = value.Left < minpadding ? minpadding : value.Left;
int r = value.Right < minpadding ? minpadding : value.Right;
int t = value.Top < minpadding ? minpadding : value.Top;
int b = value.Bottom < minpadding ? minpadding : value.Bottom;

base.Padding = new Padding(l, t, r, b);
}
}
On Fri, 06 Apr 2007 20:18:54 +0200, Nathan Laff <re******@hotmail.comwrote:
I've got a custom Panel that draws a colored border for me. Works great,
however a new problem I've run into is this.

I have the custom panel, then I want to put another panel (just a
Windows.Forms.Panel) inside it, and dock it to the top. When i do this, the
docked panel paints over the border of the custom panel where it is docked,
so some of the left and right (the height of the child panel) and all of the
top.

How can I force my custom panel to draw on top of the child panels? Oris
there another solution?

Please help, I've been spinning my wheels on this for a while now!

Thanks!



--
Happy coding!
Morten Wennevik [C# MVP]
Apr 6 '07 #4
Thanks Paul and Morten!

I figured this out a few minutes after i originally posted.

Appreciate it! Thank you!
"Morten Wennevik [C# MVP]" <Mo************@hotmail.comwrote in message
news:op.tqdpvavjdj93y5@stone...
Hi Nathan,

As Paul said, if you set the custom panel's Padding you should be able to
prevent docking to cover the borders. Furthermore, overriding Padding in
the custom panel will help you prevent the user from manually covering the
borders.

private const minpadding = 2;
public new Padding Padding
{
get { return base.Padding; }
set
{
int l = value.Left < minpadding ? minpadding : value.Left;
int r = value.Right < minpadding ? minpadding : value.Right;
int t = value.Top < minpadding ? minpadding : value.Top;
int b = value.Bottom < minpadding ? minpadding : value.Bottom;

base.Padding = new Padding(l, t, r, b);
}
}
On Fri, 06 Apr 2007 20:18:54 +0200, Nathan Laff <re******@hotmail.com>
wrote:
I've got a custom Panel that draws a colored border for me. Works great,
however a new problem I've run into is this.

I have the custom panel, then I want to put another panel (just a
Windows.Forms.Panel) inside it, and dock it to the top. When i do this,
the
docked panel paints over the border of the custom panel where it is
docked,
so some of the left and right (the height of the child panel) and all of
the
top.

How can I force my custom panel to draw on top of the child panels? Or is
there another solution?

Please help, I've been spinning my wheels on this for a while now!

Thanks!



--
Happy coding!
Morten Wennevik [C# MVP]

Apr 7 '07 #5

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

Similar topics

1
by: w.p. | last post by:
Hello! I want change default tab traversing in my app. But i don't know how to do it :( Belowe i include simple example - i want change default tab order: radiobutton "mode11" -> radiobutton...
1
by: Patrick Blackman | last post by:
I would like to have a panel control which has the ability to have different color borders, any idea how to accomplish this. Thanks
4
by: Vincent Finn | last post by:
Can anyone tell me what the difference is? Where I might need one over the other? I know in VB there was a panel and no groupBox in MFC there was a groupBox and no panel But in C# they are...
3
by: Harry | last post by:
Hi, Can anyone help. I have a asp.net page (c#), with two panels, both of which have asp:textboxes on. When I press the first button, the second panel shows fine. When I press the button in...
2
by: Jeff S | last post by:
Hello I am having an issue with changing the bordercolor of the panel control I have got to a point where I have created my own control and inherited the Panel control, then in the Overrides Sub...
4
by: Aaron Smith | last post by:
I have a panel that I have in the paint event to draw a Raised 3d border around it.. The problem is, if a msgbox is popped up or a tooltip is displayed, it leaves lines on the panel. I've tried...
3
by: John Salerno | last post by:
I'm using the sample code of the file 'simple.py' and trying to make a single window with a panel in it, but I keep getting an error. Here's my code: (I know I might need something else, like a...
4
by: tshad | last post by:
I am trying to hide and show certain parts of my code (which I have no problem doing with DW). In VS 2003, it won't let you use <div runat="server"to section of parts of my code in a table. This...
4
hemantbasva
by: hemantbasva | last post by:
We have designed an aspx page having five ajax tab in it. the data of first four are designed on page whereas for the fifth tab it renders a user control named MYDOMAIN. in the tab container's even...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.