Click here to Skip to main content
13,349,539 members (49,949 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Adding image to windows form in C# that connects(Hyperlink) to a website when clicked like I say

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.

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()

        private void Form1_Load(object sender, EventArgs e)
            // Add a link to the LinkLabel.
            LinkLabel.Link link = new LinkLabel.Link();
            link.LinkData = "";

        private void linkLabel1_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e)
        { //now connection process start here
            Process.Start(e.Link.LinkData as string);
Posted 2-Nov-12 23:57pm
Updated 4-Mar-17 6:11am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Does the Image[^] property do what you want?
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 "
Richard MacCutchan 3-Nov-12 7:54am
Well no, that's the part you have to write. You need to look at all the events and methods of the control to decide which ones you need to override to make the control do what you want.
Abhishek Pant 3-Nov-12 8:01am
Ok,Thanks for the hint.
Richard MacCutchan 3-Nov-12 12:52pm
I have just revisited this, and it would seem that it cannot be done without some text to click on. However, you could just use a PictureBox control and add your own functionality in its Click event to launch the web page.
Abhishek Pant 3-Nov-12 13:31pm
I implemented this after you said about the term override and done this successfully.
Overall,thanks again.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

i want the solution of this program or output of this program
please send the me

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.180111.1 | Last Updated 4 Mar 2017
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100