Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / January 2006

Tip: Looking for answers? Try searching our database.

Converting Image to ImageButton

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Varangian - 12 Jan 2006 14:38 GMT
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
Spam Catcher - 12 Jan 2006 14:59 GMT
"Varangian" <ofmars@gmail.com> 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?

Signature

Stan Kee (spamhoneypot@rogers.com)

Varangian - 12 Jan 2006 15:17 GMT
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));
Bruce Barker - 12 Jan 2006 18:48 GMT
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)

> No I can't. I specifically need that System.Drawing.Image object and
> then apply it to an ImageButton
[quoted text clipped - 7 lines]
> object test = (ImageButton)System.Convert.ChangeType(image,
> typeof(ImageButton));
Varangian - 16 Jan 2006 19:27 GMT
No the thing is that I want to manipulate that image with pixels etc
and then use it in an ImageButton
Spam Catcher - 17 Jan 2006 20:20 GMT
"Varangian" <ofmars@gmail.com> 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.

Signature

Stan Kee (spamhoneypot@rogers.com)

George Ter-Saakov - 12 Jan 2006 16:01 GMT
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.

> 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
S. Justin Gengo [MCP] - 12 Jan 2006 16:14 GMT
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.

Signature

Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
                           Nietzsche

> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.