Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. linking an image file to a dll

linking an image file to a dll

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netgraphicshelptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mats_mathai
    wrote on last edited by
    #1

    hi, i need to link an image with a windows control library so that evry time the control is downloaded onto the client side the image also gets downloaded. this is what i'm trying to get. i'm using a windows control on my asp.net page. The code for this control involves creating a graphics object... which in turn displays an image. the problem i'm facing now is how to specify the location of the image file. i can't specify the url as Image.FromFile does not accept urls. Sample code Public Sub DrawImagePoint(e As PaintEventArgs) Dim newImage As Image = Image.FromFile("SampImag.jpg") Dim ulCorner As New Point(100, 100) e.Graphics.DrawImage(newImage, ulCorner) End Sub

    T J 2 Replies Last reply
    0
    • M mats_mathai

      hi, i need to link an image with a windows control library so that evry time the control is downloaded onto the client side the image also gets downloaded. this is what i'm trying to get. i'm using a windows control on my asp.net page. The code for this control involves creating a graphics object... which in turn displays an image. the problem i'm facing now is how to specify the location of the image file. i can't specify the url as Image.FromFile does not accept urls. Sample code Public Sub DrawImagePoint(e As PaintEventArgs) Dim newImage As Image = Image.FromFile("SampImag.jpg") Dim ulCorner As New Point(100, 100) e.Graphics.DrawImage(newImage, ulCorner) End Sub

      T Offline
      T Offline
      tojamismis
      wrote on last edited by
      #2

      You might look at this example of using streams from the quickstart tutorials. http://samples.gotdotnet.com/quickstart/util/srcview.aspx?path=%2fquickstart%2fwinforms%2fSamples%2fGDIPlus%2fImages%2fImages.src[^] Torin Blair
      'In the immortal words of Socrates - "I drank what?".'

      1 Reply Last reply
      0
      • M mats_mathai

        hi, i need to link an image with a windows control library so that evry time the control is downloaded onto the client side the image also gets downloaded. this is what i'm trying to get. i'm using a windows control on my asp.net page. The code for this control involves creating a graphics object... which in turn displays an image. the problem i'm facing now is how to specify the location of the image file. i can't specify the url as Image.FromFile does not accept urls. Sample code Public Sub DrawImagePoint(e As PaintEventArgs) Dim newImage As Image = Image.FromFile("SampImag.jpg") Dim ulCorner As New Point(100, 100) e.Graphics.DrawImage(newImage, ulCorner) End Sub

        J Offline
        J Offline
        Jesse Squire
        wrote on last edited by
        #3

        Since the embedded WinForm control is running on the client and your image exists on a web server, you're not going to be able to open the file directly. If your project is running in an intranet environment, you may want to simply place the image on a network share. That should allow you to run your code unmodified. If dealing with the web server environment, I'd recommend that you look into using the HttpRequest object to retrieve the image from your web server in streamformat. Your WinForm control can then construct the image using the Image.FromStream method. The link that tojamismis provided is a good place to see an example using streams, and MSDN has some good examples of using the HttpRequest object. Hope that helps. :) --Jesse

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups