Control usage question

  • Thread starter Thread starter Horatiu Ripa
  • Start date Start date
H

Horatiu Ripa

1. I have an image list defined in a control
2. I want to expose trough properties the image list in a manner to be able
to change it from the container where the control is used.

How do I do that?
 
Use a property

public ImageList ControlImageList
{
get
{
return imageList;
}
}

ImageList is a class and so a reference type. This means, once you get the
reference to the image list object, you can modify it however you want.

-vJ
 
Let's be more clear:
I've made:

public System.Windows.Forms.ImageList Buttons_Image_list
{ get {return buttonsImageList;}
set {buttonsImageList = value;} }

results:
I've modify the property Buttons_Image_list property of my control (in designer, used in the container) to an image list defined there; nothing hapened or on the design or runtime.

If I put above the property definition:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] to change the default serialization from Visible to content, it initially displays the correct image list at design and runtime, but at the second build (run) , I receive an error:
"There is already a component named 'myImageList'. Components must have unique names, and names must be case-insensitive. A name also cannot conflict with the name of any component in an inherited class."

Any ideas????
--
Horatiu Ripa
Software Development Manager
Business Logic Systems LTD
21 Victor Babes str., 1st floor, 3400 Cluj-Napoca, Romania
Phone/Fax: +40 264 590703
Web: www.businesslogic.co.uk

This email (email message and any attachments) is strictly confidential, possibly privileged and is intended solely for the person or organization to whom it is addressed. If you are not the intended recipient, you must not copy, distribute or take any action in reliance on it. If you have received this email in error, please inform the sender immediately before deleting it. Business Logic Systems Ltd accepts no responsibility for any advice, opinion, conclusion or other information contained in this email or arising from its disclosure.

Vijaye Raji said:
Use a property

public ImageList ControlImageList
{
get
{
return imageList;
}
}

ImageList is a class and so a reference type. This means, once you get the
reference to the image list object, you can modify it however you want.

-vJ
 
I guess I'd need some code snippets to figure out the problem. Also, where
did "myImageList" come from?

All properties are serialized by default to code and so, you wouldn't need
the "DesignerSerializationVisibility" attribute at all.

-vJ

Let's be more clear:
I've made:

public System.Windows.Forms.ImageList Buttons_Image_list
{ get {return buttonsImageList;}
set {buttonsImageList = value;} }

results:
I've modify the property Buttons_Image_list property of my control (in
designer, used in the container) to an image list defined there; nothing
hapened or on the design or runtime.

If I put above the property definition:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
to change the default serialization from Visible to content, it initially
displays the correct image list at design and runtime, but at the second
build (run) , I receive an error:
"There is already a component named 'myImageList'. Components must have
unique names, and names must be case-insensitive. A name also cannot
conflict with the name of any component in an inherited class."

Any ideas????
--
Horatiu Ripa
Software Development Manager
Business Logic Systems LTD
21 Victor Babes str., 1st floor, 3400 Cluj-Napoca, Romania
Phone/Fax: +40 264 590703
Web: www.businesslogic.co.uk

This email (email message and any attachments) is strictly confidential,
possibly privileged and is intended solely for the person or organization to
whom it is addressed. If you are not the intended recipient, you must not
copy, distribute or take any action in reliance on it. If you have received
this email in error, please inform the sender immediately before deleting
it. Business Logic Systems Ltd accepts no responsibility for any advice,
opinion, conclusion or other information contained in this email or arising
from its disclosure.

Vijaye Raji said:
Use a property

public ImageList ControlImageList
{
get
{
return imageList;
}
}

ImageList is a class and so a reference type. This means, once you get the
reference to the image list object, you can modify it however you want.

-vJ
 
myImageList is the ImageList defined in the form where I use the control.
My knowkedge is that "DesignerSerializationVisibility" default for a public
property is "view". Anyhow it does not work at all, with or whithout
DesignerSerializationVisibility attribute set to view. The only way it works
is, as I mentioned below, with
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
but only for the first time.

I'm suspecting the property designer - code generator to have some bug...

--
Horatiu Ripa
1
Vijaye Raji said:
I guess I'd need some code snippets to figure out the problem. Also, where
did "myImageList" come from?

All properties are serialized by default to code and so, you wouldn't need
the "DesignerSerializationVisibility" attribute at all.

-vJ

Let's be more clear:
I've made:

public System.Windows.Forms.ImageList Buttons_Image_list
{ get {return buttonsImageList;}
set {buttonsImageList = value;} }

results:
I've modify the property Buttons_Image_list property of my control (in
designer, used in the container) to an image list defined there; nothing
hapened or on the design or runtime.

If I put above the property definition:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
to change the default serialization from Visible to content, it initially
displays the correct image list at design and runtime, but at the second
build (run) , I receive an error:
"There is already a component named 'myImageList'. Components must have
unique names, and names must be case-insensitive. A name also cannot
conflict with the name of any component in an inherited class."

Any ideas????
--
Horatiu Ripa
Software Development Manager
Business Logic Systems LTD
21 Victor Babes str., 1st floor, 3400 Cluj-Napoca, Romania
Phone/Fax: +40 264 590703
Web: www.businesslogic.co.uk

This email (email message and any attachments) is strictly confidential,
possibly privileged and is intended solely for the person or organization to
whom it is addressed. If you are not the intended recipient, you must not
copy, distribute or take any action in reliance on it. If you have received
this email in error, please inform the sender immediately before deleting
it. Business Logic Systems Ltd accepts no responsibility for any advice,
opinion, conclusion or other information contained in this email or arising
from its disclosure.
 
Back
Top