Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Custom Control with embedded graphic

Reply
Thread Tools

Custom Control with embedded graphic

 
 
Dave Birchok via .NET 247
Guest
Posts: n/a
 
      05-06-2004
I am developing a custom control for web forms using VS 2003. Iam putting the control in a custom control library project whichwill become a dll. This control uses a small bitmap. I don'twnat to have to copy the graphic file into each web project thatwill use this custom control. VS allows you to set the graphicfile's build action property to embedded resource. When thecustom control renders it will create HTML that I would like toreference the embedded graphic file. Is this possible?

Thanks,
--------------------------------
From: Dave Birchok

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>xTOeF9pKkUuQTsbjdTXLGQ==</Id>
 
Reply With Quote
 
 
 
 
Victor Garcia Aprea [MVP]
Guest
Posts: n/a
 
      05-07-2004
Hi Dave,

Yes its possible. The most common approach is to write a handler to serve
embedded images from assemblies. ASP.NET's next version will have built-in
support for this. You can take a look at this article[1] which contains
enough info and detail about how it works and so it should serve as a
jumpstart for your own implementation in ASP.NET 1.x

[1]
http://msdn.microsoft.com/asp.net/co...ebresource.asp

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup

"Dave Birchok via .NET 247" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
I am developing a custom control for web forms using VS 2003. I am putting
the control in a custom control library project which will become a dll.
This control uses a small bitmap. I don't wnat to have to copy the graphic
file into each web project that will use this custom control. VS allows you
to set the graphic file's build action property to embedded resource. When
the custom control renders it will create HTML that I would like to
reference the embedded graphic file. Is this possible?

Thanks,
--------------------------------
From: Dave Birchok

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>xTOeF9pKkUuQTsbjdTXLGQ==</Id>


 
Reply With Quote
 
 
 
 
Andrei Sinelnikov
Guest
Posts: n/a
 
      05-07-2004
Here is one way of retrieving embedded resource.
I don't know though how you can apply it to image. But I think that
this is possible.

' Retrieving XML-file from the embedded resources.
Dim thisExe As System.Reflection.Assembly
thisExe = System.Reflection.Assembly.GetExecutingAssembly()
' Replace "AssemblyName.FileName.xml" with the name of the
resource, as it is known in the assembly.
' Use the GetManifestResourceNames method of the Assembly
object to find the resource name.
Dim strFileName As System.IO.Stream = _
thisExe.GetManifestResourceStream("<Type Accembly Name
Here>.Reports.xml")
' Read XML.
Dim doc As XmlDocument = New XmlDocument()
doc.Load(strFileName)


WBR,
Andrei
 
Reply With Quote
 
Fred Hirschfeld
Guest
Posts: n/a
 
      05-09-2004
I have a complete code for this if you would like... The last remaining part
of this is how do I use the embedded graphics at design-time? I know I could
create a custom designer for this, but is there any other way?

Fred

"Dave Birchok via .NET 247" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
I am developing a custom control for web forms using VS 2003. I am putting
the control in a custom control library project which will become a dll.
This control uses a small bitmap. I don't wnat to have to copy the graphic
file into each web project that will use this custom control. VS allows you
to set the graphic file's build action property to embedded resource. When
the custom control renders it will create HTML that I would like to
reference the embedded graphic file. Is this possible?

Thanks,
--------------------------------
From: Dave Birchok

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>xTOeF9pKkUuQTsbjdTXLGQ==</Id>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to mouseover a GRAPHIC . . . that launches another (freestanding) GRAPHIC (ie. when flash is _not_ available)? 50 SOMETHING GAL HTML 3 12-10-2006 01:10 AM
feeding a SQLDataSource embedded in an .ascx user control a custom property assigned to that control ASP .Net 4 07-16-2006 12:20 PM
Databind an embedded control in an embedded datagrid Thomas Dodds ASP .Net Datagrid Control 0 07-26-2004 08:20 PM
Page Load fired 3 times Web user control is embedded in a custom control Thomas Ekegren ASP .Net Building Controls 0 09-03-2003 05:37 PM
ControlDesigner not invoked on custom control when control is rendered within another custom control Matt Sokol ASP .Net Building Controls 2 08-07-2003 07:13 AM



Advertisments