473,406 Members | 2,698 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,406 software developers and data experts.

Cannot parent controls to a custom(derived) control

Hi all!
I've made a custom group-box control derived from a GroupBox. Additionally
I've made a ControlDesigner derived class associated with my group box to
remove some unneeded properties.
But after utilizing this ControlDesigner, I can't parent any control to my
group box in a design view(When not applying ControlDesigner everything
works fine).
Here's the code:

internal class CGroupBoxDesigner : ControlDesigner
{
public CGroupBoxDesigner()
{
}
protected override void PostFilterProperties(IDictionary Properties)
{
Properties.Remove("BackgroundImage");
Properties.Remove("BackColor");
Properties.Remove("FlatStyle");
}
}

and this is how is this ControlDesigner is applied to a group box:
[Designer(typeof(CGroupBoxDesigner)), Description("Custom group-box
control.")]
public class CGroupBox : System.Windows.Forms.GroupBox
{
.......
}

I know that I'm missing something simple here ... Please help.

Thanx!
D.
Nov 17 '05 #1
2 1914
Try deriving from
System.Windows.Forms.Design.ParentControlDesigner (System.Design assembly)
instead of ControlDesigner.

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"CroDude" <di***********@zg.htnet.hr> wrote in message news:da**********@news1.xnet.hr...
Hi all!
I've made a custom group-box control derived from a GroupBox. Additionally
I've made a ControlDesigner derived class associated with my group box to
remove some unneeded properties.
But after utilizing this ControlDesigner, I can't parent any control to my
group box in a design view(When not applying ControlDesigner everything
works fine).
Here's the code:

internal class CGroupBoxDesigner : ControlDesigner
{
public CGroupBoxDesigner()
{
}
protected override void PostFilterProperties(IDictionary Properties)
{
Properties.Remove("BackgroundImage");
Properties.Remove("BackColor");
Properties.Remove("FlatStyle");
}
}

and this is how is this ControlDesigner is applied to a group box:
[Designer(typeof(CGroupBoxDesigner)), Description("Custom group-box
control.")]
public class CGroupBox : System.Windows.Forms.GroupBox
{
......
}

I know that I'm missing something simple here ... Please help.

Thanx!
D.

Nov 17 '05 #2
Yep! That worked superbly!

Thanx Dave!

"Dave" <NO*********@dotcomdatasolutions.com> wrote in message
news:um**************@TK2MSFTNGP09.phx.gbl...
Try deriving from
System.Windows.Forms.Design.ParentControlDesigner (System.Design assembly) instead of ControlDesigner.

--
Dave Sexton
dave@www..jwaonline..com

Nov 17 '05 #3

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

Similar topics

2
by: John B | last post by:
Hello I want to create a set of controls that have some common methods and properties. I was thinking that I should subclass the UserControl class and add these common features there and then...
0
by: Scott Yenor | last post by:
Hello, I am writing a control library that has a control that inherits from System.Web.UI.Control. The control works fine and I am able to loop through the child controls and display everything...
3
by: Eric Sabine | last post by:
I've created a custom control (ascx) which contains a tree view, a drop down list, and a listbox. The custom control is included in a web form and at runtime, won't compile (I get the...
1
by: Hugo Flores | last post by:
Hi, I created a custom cuntrol and I want to be able to access the page object where my control was added (the page that contains my control). If I use the page object in my custom control or...
0
by: spacehopper_man | last post by:
hi - I am writing a "tab" control. - but it's losing the viewstate of the content pane when I switch between tabs. can anyone shed any light on why I'm losing ViewState based on my simple...
3
by: Antuane | last post by:
hi guys, its me again, with a few simple (probably silly) quesetion... hi guys, i've managed to create a custom textbox class. & i'd like to access the parent control (in this case this would be...
2
by: Joe | last post by:
Hello all, When I drop a control (say a Button) on my user control, the button is added to the parent control of my user control and not my control. For example if my user control is on a panel...
1
by: rizwanahmed24 | last post by:
Hello i have created a custom control. i have placed two template controls on it. One is check box and second is picture box. The custom control also contain two picture boxes as property. These...
0
by: zb | last post by:
Here is the page architecture: Page loads multiple user controls (including nested user controls) dynamically based on parameters provided into place holders. Note: The page only has the logic to...
2
by: =?Utf-8?B?V29ua28gdGhlIFNhbmU=?= | last post by:
Hello, I have an existing (WPF) Class Library project that I'd like to add a WPF Custom Control to. However, when I try to Add New Item, that isn't one of the available options. Perhaps this...
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: 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
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
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,...
0
Oralloy
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,...
0
jinu1996
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...
0
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...
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.