Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / July 2006

Tip: Looking for answers? Try searching our database.

Sub Componets as Properties in other Controls

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Christian.Wall@gmx-topmail.de - 12 Jul 2006 12:17 GMT
Hello,

I've got the following situation:

I want to create a component, which has one public property. This
property is an ImageList.
Now I want to drop this new compnonent on my form. On this form i also
have a TreeView which have a property "ImageList". And now my question
is: How can I select my ImageList in my Component as the Imagelist for
the treeview. I want to select it in the propertygrid and not by
writing code.

Is there a possibility?

with best regards
Chris
Roman - 12 Jul 2006 13:48 GMT
Hi Chris
Just inherit your component from the ImageList component :)

Signature

Thanks Roman
--

> Hello,
>
[quoted text clipped - 12 lines]
> with best regards
> Chris
Christian.Wall@gmx-topmail.de - 12 Jul 2006 13:54 GMT
Roman schrieb:

> Hi Chris
> Just inherit your component from the ImageList component :)
[quoted text clipped - 18 lines]
> > with best regards
> > Chris

Hi Roman,

this is impossible, because ImageList is sealed class :-(
Roman - 12 Jul 2006 14:10 GMT
I have not check it before posting. Sorry. I have created another solution
for you. Hope this make a trick.
using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using System.ComponentModel.Design;

namespace WindowsApplication6 {

public partial class Form1 : Form {

public Form1() {

InitializeComponent();

}

}

public class MyImageListDesigner :
System.ComponentModel.Design.ComponentDesigner {

public override void InitializeNewComponent(System.Collections.IDictionary
defaultValues) {

IDesignerHost host = GetService(typeof(IDesignerHost)) as IDesignerHost;

host.Container.Add(((MyImageList)Component).ImageList);

base.InitializeNewComponent(defaultValues);

}

}

[Designer("WindowsApplication6.MyImageListDesigner")]

public class MyImageList : Component {

ImageList list;

public MyImageList() {

list = new ImageList();

}

public ImageList ImageList {

get { return list; }

set { list = value; }

}

}

}

Signature

Thanks Roman
--

>
> Roman schrieb:
[quoted text clipped - 25 lines]
>
> this is impossible, because ImageList is sealed class :-(
Christian.Wall@gmx-topmail.de - 12 Jul 2006 15:15 GMT
No Problem. Thank you for this example. It's very nice, but not exactly
what I need. It creates a new instance of the ImageList in MyImageList.
I only need the reference. Is there a possibilty to register some
properties vom MyImageList in the Designer as Controls?

Thanks.

Roman schrieb:

> I have not check it before posting. Sorry. I have created another solution
> for you. Hope this make a trick.
[quoted text clipped - 98 lines]
> >
> > this is impossible, because ImageList is sealed class :-(

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.