473,395 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Converting Image to ImageButton

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

Jan 12 '06 #1
5 2612
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));

Jan 12 '06 #2
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" <of****@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro 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

Jan 12 '06 #3
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" <of****@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro 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

Jan 12 '06 #4
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" <of****@gmail.com> wrote in message
news:11********************@f14g2000cwb.googlegrou 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));

Jan 12 '06 #5
No the thing is that I want to manipulate that image with pixels etc
and then use it in an ImageButton

Jan 16 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ester | last post by:
I have an interior design of a living room with lights and aircond image. My task is to load the living room image without any light and aircond images as background image of a WebForm after that I...
2
by: Ester | last post by:
Instead of drag and drop image button from Toolbox and name the image button id on the properties box, I would like to load image button ID from database. I created a database table that stores...
1
by: Holly | last post by:
Hi, I have a page (A) that allows users to enter addresses and displays direction information and map images. The page A calls Microsoft's mappoint web service, gets the route info and map image....
6
by: ruca | last post by:
Hi gurus, I have a imagebutton in my WebForm, and I want that when I click (mouse down) on her the imagebutton change image and when I "unclick" (mouse up) change to the original image. Basically...
3
by: jens.buchta | last post by:
Hi! I'm using a DataGrid with a template column to display an Image inside of it. I'm hooking into its OnPrerender-Event to set the ImageURL-Property dynamically. Everything works just fine...
10
by: Edwin Knoppert | last post by:
I have an asp.net imagebutton with a clickevent. I have enclosed an anchor around the image and a small text. If i click the image the event is executed (while the href of the anchor shows in the...
9
by: tshad | last post by:
Is there a way to display images (imageButtons or linkbuttons for instance) as a max size (200px by 50px) and not have it stretch the image? What I want to be able to do is limit the real estate...
3
by: Ganesh | last post by:
Hi There, Could you some tell me the difference between Image and ImageButton, which one do i need to use if i want to show some picture on the html Thanks Ganapathi
0
by: Sully | last post by:
Hi Guys, I have this about 98% done and I cannot get it work properly. I have a Repeater bound to a MySQL DataSource, inside the Repeater I have an ImageButton, outside the repeater I have a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.