473,396 Members | 1,810 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,396 software developers and data experts.

Problems in a UserControl with a Container panel

Hello everybody!

I am trying to create a UserControl that act as a (Expandable Panel).

I created a UserControl (LGradientPanel) with two panels in it: LCaptionPanel and the LInnerPanel. The last one should "hold" the controls I will add to the UserControl.

The LCaptionPanel will have a gradient fill and the text (caption) of the panel. No controls should be added to this panel.

The LInnerPanel is the container area and shoul hold the controls dragged from the VisualStudo toolbox.

How can I "tell" the designer that ONLY the LInnerPanel should accept controls (dropped from the toolbox) ?

The problem I am getting is that when I drag controls into the GradientPanel, the controls are inserted in the LGradientPanel control. At run time, in the InitializeComponent(), I can see the following command line:
this.lGradientPanel2.Controls.Add(this.textBox3);

I want to add them into the LInnerPanel. How can I do that? Something like
this.lGradientPanel2.InnerPanel.Controls.Add(this. textBox3);

Here is the structure I am using:

namespace LXPControls
{
internal class LCaptionPanel : System.Windows.Forms.Panel
{
(...)
public LCaptionPanel()
{
SetStyle(ControlStyles.ResizeRedraw, true);
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.Selectable, true);
SetStyle(ControlStyles.ContainerControl, false);
SetStyle(ControlStyles.SupportsTransparentBackColo r, true);
(...)
}

internal class LInnerPanel : System.Windows.Forms.Panel
{
(...)
public LInnerPanel()
{
SetStyle(ControlStyles.ResizeRedraw, true);
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.Selectable, true);
SetStyle(ControlStyles.ContainerControl, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.SupportsTransparentBackColo r, true);
(...)
}

[Designer("System.Windows.Forms.Design.ParentContro lDesigner, System.Design", typeof(System.ComponentModel.Design.IDesigner))]
public class LGradientPanel : System.Windows.Forms.Control
{
(...)
private LCaptionPanel captionPanel;
private LInnerPanel innerPanel;
(...)

public LGradientPanel()
{
SetStyle(ControlStyles.ResizeRedraw, true);
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.Selectable, true);
SetStyle(ControlStyles.ContainerControl, false);
(...)
}
}

Does anybody have an idea on what I am doing wrong?

Thanks everybody
Regards,
Carlos
Oct 15 '07 #1
0 2185

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Lokhan Wong | last post by:
My question is whether it's possible to change the properties of a panel, that resides on the webform containing the usercontrol, in the usercontrol itself. Like this: <form> <asp:panel...
1
by: sergio | last post by:
Hi, I've created a usercontrol that acts like a container. Its a panel with color borders. The problem is that when I drop a control into this usercontrol the control added doesn't appear, then I...
7
by: Alon | last post by:
Hi, I'm making my own control which holds some buttons ant textboxes and also has a panel control. in design time i want to drop another controls into the panel that is in my usercontrol. the...
2
by: Simon Verona | last post by:
I have a problem, best explained by example. I have a usercontrol which contains a text box and a button. If the button is clicked then the calender control is displayed as a "popup" so that a...
7
by: Dino Buljubasic | last post by:
Hi, I am using C# 2.0 (VS2005) to build my user control that contains a number of dynamically loaded ListViews. ListViewItems have their ForeColor properties set to either black or blue to...
1
by: TheSteph | last post by:
Hi ! I would like to create a UserControl that act as a « Collapsible Panel ». So I have a UserControl with two panels : a "Header panel" at the top, and a "Container Area Panel"...
10
by: Benton | last post by:
Hi there, I have a UserControl with a couple of textboxes and a couple of buttons ("Save" and "Cancel"). The Click event for this buttons is in the UserControl's codebehind of course, so here's...
3
by: marfi95 | last post by:
My application consists of basically a treeview on the left side, along with a panel control that takes up the right side. When nodes are clicked on the left, the data on the right side of the...
2
by: John Kotuby | last post by:
Hi all, I have a page that displays the contents of a business document in HTML that uses multiple select queries to provide the relevent data. There is a call to the parent table and then...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
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...
0
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,...

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.