We help IT Professionals succeed at work.

C# image link

kyrenator
kyrenator asked
on
Medium Priority
2,916 Views
Last Modified: 2013-12-14
How can i make an image a link for a site? For example i want when someone clicks the image to go at www.example.com
Comment
Watch Question

You have to be more specific , what is your environment? Is it a web application ? ASP.NET? Windows application? Windows Forms, MFC, ??
You see what I mean...

Author

Commented:
It is a Windows Form and the language i am writing is c#!
Add a LinkLabel control, assign the Image property, clear the Text property, set the AutoSize property to false so you can play with the size...
Add this to the LinkClicked event:



private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("http://www.experts-exchange.com")
        }

Open in new window

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Sorry,
Actually use PictureBox and handle the Click event:


private void pictureBox1_Click_1(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("http://www.experts-exchange.com");
        }

Open in new window

Author

Commented:
Thanks m8!
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.