Bitmap / Icon question - Custom Controls

J

James Radke

Hello,

I am building a custom control. It has functionality similar to the Timer,
and was curious, is there a way for me to actually use the same icon as the
timer control for mine when it is displayed in the VS.NET toolbar? I would
also like to use the same icon to display in the designer to show that the
control exists, and where it is in the web page, even though it would not
show the icon at run-time...

Can anyone give me an idea of how I could do this?

Thanks!

Jim
 
J

James Radke

As an addendum to this, in case I can't use the existing timer control icon;
I have figured out how to create and use my own icon for the image that
shows up on the toolbar; however, for the designer, if I want to use an
image, the only way I can figure out how to do it is to specify an image
control, by using a URL.

Is there a way that I can use the same embedded resource icon for BOTH the
toolbar AND the image to be displayed in the designer? Since the designer
is obviously run on a windows machine, why am I limited to web based
controls such as the image to display static content; versus being able to
use the picturebox which would allow me to use an embedded icon?

And, finally, how does the system timer place the embedded control into the
separate area for non-visible controls when dragged to a web page? How can
I make my Custom Control work in that manner? Is there a way to specify in
the designer to do this?

Thanks!

Jim
 
J

Jeffrey Tan[MSFT]

Hi James,

Based on my understanding, you want to make a image show in the designer
for you custom web control.
Because the design-time support use GetDesignTimeHtml method to get the
html code, I think you can return a <img> tag whose image url points to the
picture you want to display.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

James Radke

Jeffrey,

Yes, I can use the image tag and display it (I have gotten that to work);
but I would like to include the image as the included bitmap, and not need
an external resource that each designer would have to access from a URL.
(i.e. what happens if each designer doe not have a web server running
locally, but are working off a remote development server - then there are
installation issues)?

And I cannot figure out how to use the included bitmaps / images to be used
as both the icon in the toolbar, and as the image in the designer.

Do you understand my issue?

Jim
 
J

Jeffrey Tan[MSFT]

Hi James,

I understand your issue, I think we can only get this done through the
image on the disk.
Because the design-time does not expose all the run-time support.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi James,

After my confirm from others, there is no way to retrieve the embed image
resource through GetDesignTimeHtml.
The workaround I can think of is use Assembly.GetManifestResourceStream and
ResourceManager to get this image stream and write it to disk temporarily.
Then use <img src=""> to show your control image in GetDesignTimeHtml.
For more information about how to get the image stream from resource,
please refer to the article below:
http://www.codeproject.com/dotnet/embeddedresources.asp

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
M

Michael Stuart

Just an FYI... you'll be able to get internal resources during
design-time with the next version of .net.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top