Click here to Skip to main content
15,894,294 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Adding image to windows form in C# that connects(Hyperlink) to a website when clicked like I say http://www.codeproject.com/

I changed image of Linklabel but the text of linklabel is also displayed in the form;But I want to show only image in the form to be displayed.
On text deletion of linklabel-image is also not displayed.
I used code(below)and changed image using properties of linklabel.

C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace linklabelcontrols
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // Add a link to the LinkLabel.
            LinkLabel.Link link = new LinkLabel.Link();
            link.LinkData = "http://www.codeproject.com";
            linkLabel1.Links.Add(link);
        }

        private void linkLabel1_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e)
        { //now connection process start here
            Process.Start(e.Link.LinkData as string);
        }
    }
}
Posted
Updated 4-Mar-17 5:11am
v2

i want the solution of this program or output of this program
please send the me
 
Share this answer
 
Does the Image[^] property do what you want?
 
Share this answer
 
Comments
Abhishek Pant 3-Nov-12 5:32am    
Oops! No,
Like you wrote Image above with with a connected link now the same thing I want to write on Windows Forms with a image over there that connects the link in place of text as "Image".
Richard MacCutchan 3-Nov-12 5:58am    
I understand what you are trying to do but I don't have time to test this myself, so I'm not sure what it looks like. What happens if it does not have any text?
Abhishek Pant 3-Nov-12 6:18am    
The Image also disappears. But link remains there. Then If nothing is displayed how could the user know that there is a link.
Richard MacCutchan 3-Nov-12 7:35am    
I have had a quick look at this and it seems that it requires some text to be clicked on. I think you will have to add some extra code to override some of the default behaviour in order to achieve what you want.
Abhishek Pant 3-Nov-12 7:45am    
Can u elaborate this "extra code to override some of the default behaviour "

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900