Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Converting Image to ImageButton

Reply
Thread Tools

Converting Image to ImageButton

 
 
Varangian
Guest
Posts: n/a
 
      01-12-2006
Hi there experts,

Is there a way to convert a System.Drawing.Image to an ImageButton.
Maybe using ChangeType I don't know!

Thank you

 
Reply With Quote
 
 
 
 
Spam Catcher
Guest
Posts: n/a
 
      01-12-2006
"Varangian" <> wrote in news:1137076719.526844.90480
@g14g2000cwa.googlegroups.com:

> Hi there experts,
>
> Is there a way to convert a System.Drawing.Image to an ImageButton.
> Maybe using ChangeType I don't know!



They're different classes, you can't just convert them.

But you can always declare a new ImageButton and assign the Image to the
ImageButton?


--
Stan Kee ()
 
Reply With Quote
 
 
 
 
Varangian
Guest
Posts: n/a
 
      01-12-2006
No I can't. I specifically need that System.Drawing.Image object and
then apply it to an ImageButton

I'm trying to use these lines of code currently! What I am doing wrong,
I'm getting error "Object must implement IConvertible"... what is meant
by that error?

const string url = @"c:\Inetpub\wwwroot\pagerror.gif";
object image = System.Drawing.Image.FromFile(url);
object test = (ImageButton)System.Convert.ChangeType(image,
typeof(ImageButton));

 
Reply With Quote
 
George Ter-Saakov
Guest
Posts: n/a
 
      01-12-2006
Sounds the same as if you said "How can I convert a brush to doorbell"
Even that does not show how far away those 2 objects are.

Most likely you need to rephrase it since I doubt that you want that.

George.




"Varangian" <> wrote in message
news: ups.com...
> Hi there experts,
>
> Is there a way to convert a System.Drawing.Image to an ImageButton.
> Maybe using ChangeType I don't know!
>
> Thank you
>



 
Reply With Quote
 
S. Justin Gengo [MCP]
Guest
Posts: n/a
 
      01-12-2006
Varangian,

No, you can't do that. But what do you want to do with the image once you
have it? Are you trying to dynamically create an image and then attach it to
an image button? You can do that by creating the image, saving it to the
file system and then setting the image button's image source.

Let us know exactly what your end result needs to be and I'm sure we'll be
able to help you get there.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Varangian" <> wrote in message
news: ups.com...
> Hi there experts,
>
> Is there a way to convert a System.Drawing.Image to an ImageButton.
> Maybe using ChangeType I don't know!
>
> Thank you
>



 
Reply With Quote
 
Bruce Barker
Guest
Posts: n/a
 
      01-12-2006
you are confusing concepts. an ImageButton, is not an image, its a html
control, with a property that refers to URL that returns an image. thus an
image button really has no image, it renders the following html

<input type="image" src="myimage.gif">

in your case you probably want the src to refer to a page that returns an
image

<input type="image" src="myImageProducer.aspx">

you can google for samples of aspx pages that return an image.

-- bruce (sqlwork.com)





"Varangian" <> wrote in message
news: ps.com...
> No I can't. I specifically need that System.Drawing.Image object and
> then apply it to an ImageButton
>
> I'm trying to use these lines of code currently! What I am doing wrong,
> I'm getting error "Object must implement IConvertible"... what is meant
> by that error?
>
> const string url = @"c:\Inetpub\wwwroot\pagerror.gif";
> object image = System.Drawing.Image.FromFile(url);
> object test = (ImageButton)System.Convert.ChangeType(image,
> typeof(ImageButton));
>



 
Reply With Quote
 
Varangian
Guest
Posts: n/a
 
      01-16-2006
No the thing is that I want to manipulate that image with pixels etc
and then use it in an ImageButton

 
Reply With Quote
 
Spam Catcher
Guest
Posts: n/a
 
      01-17-2006
"Varangian" <> wrote in news:1137439646.029087.105410
@o13g2000cwo.googlegroups.com:

> No the thing is that I want to manipulate that image with pixels etc
> and then use it in an ImageButton



You'll need to stream the image to the image button via a second webpage.

So rather than linking to a .gif or .jpg file, you'll like to a .aspx file
which in actually streams the graphic's content.



--
Stan Kee ()
 
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
Image & ImageButton controls Jason ASP .Net 0 06-12-2004 11:57 PM
Image & ImageButton controls Jason ASP .Net 0 06-12-2004 11:57 PM
Image & ImageButton controls Jason ASP .Net 0 06-12-2004 11:57 PM
SQL image (jpeg) to Image or ImageButton or TableRow etc.. RobertH ASP .Net 3 02-17-2004 02:39 AM
image/imagebutton client validation ganesh kolappan ASP .Net 2 07-03-2003 06:56 PM



Advertisments
 



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