Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Add a Bitmap ???

    I need to add a dynamical!! generated bitmap to an image
    button! What is the way to do it? The ImageButton offers
    only the URL property. But this are physical file paths.

    Dim new_bitmap As Bitmap = New Bitmap(850, 200)

    Dim image_button As New System.Web.UI.WebControls.ImageButton

    Thanks a lot

    Rob
    Robert Guest

  2. Similar Questions and Discussions

    1. how to edit bitmap which is imported in flash using xmland save the edited bitmap back to xml in flash.
      hi all It would be appreciated if any one let me know how to edit bitmap which is imported in flash using xml and save the edited bitmap back to...
    2. How to cut out bitmap ???
      Show me the way to cut out bitmap ,please ??? Thanks
    3. Break Apart Bitmap
      Hi all I have a bitmap imported into Flash MX. There are several ares of this image I would like to use for "buttons". Am I right in saying that...
    4. Bitmap to vectors?
      Actually, FreeHand's trace tool is pretty good, in my opinion. Colors and shapes are reproduced very well. BUT... if you want to be able to edit...
    5. undo bitmap?
      Hi, is there any way to "undo" an image after I flattened/saved it to bitmap? (undo CNTL + Z not an option - too late for that) Thanks. John
  3. #2

    Default Re: Add a Bitmap ???

    The problem you have is that your working in the server side's memory... and
    so the image you're creating and using is, the server's buffer. When the
    request from the client to the server is made to pass it a picture, it needs
    to be a file that's requested, or the server won't know how to send it, and
    the client won't know how to receive it and show it.

    The only way you can do this is to first stream out the buffer, (i.e, save
    the bitmap to disk), then take that URL you've just saved the file too and
    pass that to the image button's URL.
    I'd suggest using something like in the ASP page...

    <A HREF="somefolder/somefile"><IMG BORDER=no ID=myImage
    SRC="images/myTempPick.jpg"></A>

    then when you've gotten the bitmap and saved it, something like... (aspx.vb
    file)

    dim ClientScript as String = ""
    ClientScript += "<SCRIPT language=javascript>" & vbNewLine
    ClientScript += " document.all.myImage.src = " & stringImageURL &
    vbNewLine ' where stringImageURL is a string containing your image
    location you've saved out
    ClientScript += "</SCRIPT>
    RegisterStartupScript( "ImageChange", ClientScript )

    This code then writes the client side script to change your image URL from
    the TempPick to whatever pic you now want. Note that I used HTML's standard
    <IMG> rather than the <ASP:...>, I haven't played much with the ASP.net
    controls in this way so am not sure what they'll do, try it!

    hope that helps, and works!

    Dan.


    "Robert" <robert_dx@gmx.com> wrote in message
    news:09d901c3452c$32d281c0$a501280a@phx.gbl...
    > I need to add a dynamical!! generated bitmap to an image
    > button! What is the way to do it? The ImageButton offers
    > only the URL property. But this are physical file paths.
    >
    > Dim new_bitmap As Bitmap = New Bitmap(850, 200)
    >
    > Dim image_button As New System.Web.UI.WebControls.ImageButton
    >
    > Thanks a lot
    >
    > Rob

    Daniel Bass Guest

  4. #3

    Default Re: Add a Bitmap ???

    You don't want a Bitmap. You want an image format that IS supported by
    browsers, such as JPG or GIF. What you need to do is to create an ASPX page
    that uses Response.BinaryWrite() to write the binary image to the Response.
    This ASPX page must also set the ContentType to "image/jpg" or "image/gif"
    to inform the browser that it is not an ASPX page that is being returned,
    but an image. Your image button can then use the URL of the ASPX page as the
    URL to the image.

    HTH,

    Kevin Spencer
    Microsoft FrontPage MVP
    Internet Developer
    [url]http://www.takempis.com[/url]
    Some things just happen.
    Everything else occurs.

    "Robert" <robert_dx@gmx.com> wrote in message
    news:09d901c3452c$32d281c0$a501280a@phx.gbl...
    > I need to add a dynamical!! generated bitmap to an image
    > button! What is the way to do it? The ImageButton offers
    > only the URL property. But this are physical file paths.
    >
    > Dim new_bitmap As Bitmap = New Bitmap(850, 200)
    >
    > Dim image_button As New System.Web.UI.WebControls.ImageButton
    >
    > Thanks a lot
    >
    > Rob

    Kevin Spencer Guest

  5. #4

    Default Re: Add a Bitmap ???

    The May/June 2003 issue of CoDe (component developer magazine) had some
    great articles on doing things of this nature. Basically, you need to use
    the System.Drawing and System.Drawing.Imaging libraries. Use the source of
    your image as an aspx page with a Response.ContentType = "image/jpeg" or
    "image/gif" etc. I use something like this in a few of my pages <img
    src="paint.aspx"> to create some dynamic images.

    I don't want to violate copyright laws by repeating the source code that's
    in there,
    "Robert" <robert_dx@gmx.com> wrote in message
    news:09d901c3452c$32d281c0$a501280a@phx.gbl...
    > I need to add a dynamical!! generated bitmap to an image
    > button! What is the way to do it? The ImageButton offers
    > only the URL property. But this are physical file paths.
    >
    > Dim new_bitmap As Bitmap = New Bitmap(850, 200)
    >
    > Dim image_button As New System.Web.UI.WebControls.ImageButton
    >
    > Thanks a lot
    >
    > Rob

    Kenn Ghannon Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139