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

Control Behavior

Hey guys and gals,

I am creating a composite control and need to expose the ImageList and
all related properties of a label in this control; I do not want to
expose the entire label. What I am looking for is a way to get the
ImageKey and ImageIndex properties to behave the same as they do with
the base label control, i.e. I want to a drop down with the available
values in the ImageKey and ImageIndex in the property window when a
user adds the control to their form. Any ideas on how I can expose
these properly? I want them to have the same return types as their
respective values. Am I missing something very easy or is this a more
involved problem?

Thanks,

Jimmy V

Jul 12 '07 #1
2 1427
Jimmy,

Well, creating something with the appropriate return types is easy, just
expose ImageIndex and ImageKey properties on your component which will just
forward the calls to the underlying imagelist control.

To get designer support, you should look at those properties on the
Label in Reflector. If you do, you will see that there are some attributes
that are attached to the property. You want to copy these attributes to the
same properties on your control. The attributes you want are:

DefaultValue
Editor
RefreshProperties
TypeConverter

Once you apply those, it should give you what you want.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jimmy V" <go*****@gmail.comwrote in message
news:11**********************@w3g2000hsg.googlegro ups.com...
Hey guys and gals,

I am creating a composite control and need to expose the ImageList and
all related properties of a label in this control; I do not want to
expose the entire label. What I am looking for is a way to get the
ImageKey and ImageIndex properties to behave the same as they do with
the base label control, i.e. I want to a drop down with the available
values in the ImageKey and ImageIndex in the property window when a
user adds the control to their form. Any ideas on how I can expose
these properly? I want them to have the same return types as their
respective values. Am I missing something very easy or is this a more
involved problem?

Thanks,

Jimmy V

Jul 12 '07 #2
On Jul 12, 3:56 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Jimmy,

Well, creating something with the appropriate return types is easy, just
expose ImageIndex and ImageKey properties on your component which will just
forward the calls to the underlying imagelist control.

To get designer support, you should look at those properties on the
Label in Reflector. If you do, you will see that there are some attributes
that are attached to the property. You want to copy these attributes to the
same properties on your control. The attributes you want are:

DefaultValue
Editor
RefreshProperties
TypeConverter

Once you apply those, it should give you what you want.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"Jimmy V" <gome...@gmail.comwrote in message

news:11**********************@w3g2000hsg.googlegro ups.com...
Hey guys and gals,
I am creating a composite control and need to expose the ImageList and
all related properties of a label in this control; I do not want to
expose the entire label. What I am looking for is a way to get the
ImageKey and ImageIndex properties to behave the same as they do with
the base label control, i.e. I want to a drop down with the available
values in the ImageKey and ImageIndex in the property window when a
user adds the control to their form. Any ideas on how I can expose
these properly? I want them to have the same return types as their
respective values. Am I missing something very easy or is this a more
involved problem?
Thanks,
Jimmy V- Hide quoted text -

- Show quoted text -
Awesome Nick, that did the trick, I'm gonna have to go and study my
attribute classes!

Jul 12 '07 #3

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

Similar topics

5
by: Paul Schnitter | last post by:
Update: My custom control is based on the article "Creating Visual Basic .NET controls from scratch" in "Adventures in .NET" on MSDN. It is designed to be a replacement for the VB6 shape...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
3
by: dcassar | last post by:
I am working on a complex server control that dynamically creates an HtmlInputHidden control that stores its value. As far as the postback process is concerned, this hidden input acts as the...
3
by: senfo | last post by:
I developed a Windows control in VS 2005 that inherits from the PictureBox Control that adds the ability to select images in a Windows application. It is, however, experiencing a strange issue...
2
by: hzgt9b | last post by:
Using VS2003, VB.NET, BACKGROUND I have a window forms based application that will be distributed and executed directly from CD media. The app contains a TreeView control and a WebBroswer...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
3
by: Nathan Laff | last post by:
I have a custom Control that is a label, however I inherit from Control... 1) I override onClick and do a DrawFocusRectangle, that works great. How do I clear the focus rectangle once something...
4
by: Mufasa | last post by:
I'm going to create a server control in ASP.Net/C# that reacts to a couple of buttons. Thing is - I want to have the functions there for the buttons so if somebody doesn't program the command for...
5
by: AG | last post by:
I realize that the obvious suggestion would be malware, but my definitions are up to date and I have already scanned for it. I have also tried disabling all IE add-ons. I just rebuilt and...
0
by: =?Utf-8?B?Q29kZVJhem9y?= | last post by:
Hi, Is it possible to access an htc file from the windows webbrowser control? I am receiving the following error: "An error has occurred in the script on this page." "Error: Access is denied...
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...
1
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.