Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create custom control linkbutton from the linklabel for the windows form application.
how it can be possible.
Posted

1 solution

Surely, you didn't mention any specific worries, so perhaps start by reading this: Developing Custom Windows Forms Controls with the .NET Framework[^]

and few examples:
- Divider Panel - A tutorial on creating a custom Windows Forms control from Start to Toolbox[^]
- Writing your Custom Control: step by step[^]

Addition:
To use the same event handler for multiple link labels you could have something like:
C#
linkLabel1.LinkClicked += new LinkLabelLinkClickedEventHandler(AllLinkLabels_LinkClicked);
linkLabel2.LinkClicked += new LinkLabelLinkClickedEventHandler(AllLinkLabels_LinkClicked);
linkLabel3.LinkClicked += new LinkLabelLinkClickedEventHandler(AllLinkLabels_LinkClicked);


And the event handler itself could be modified from the following:
C#
private void AllLinkLabels_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
   System.Diagnostics.Process.Start((string)e.Link.LinkData);
}

Of course it needs more logic, exception handling etc, but that would be a start.
 
Share this answer
 
v2
Comments
fjdiewornncalwe 11-Jan-13 12:24pm    
+5. Well put.
Wendelius 11-Jan-13 12:51pm    
Thanks Marcus :)
tusharkaushik 11-Jan-13 14:11pm    
but i want that if user clicked at newly created inherited control linkbutton , the given url will open in an browser.
can it possible!
fjdiewornncalwe 11-Jan-13 14:47pm    
Of course it is possible. Just write the code to do that in the click handler.
Wendelius 11-Jan-13 15:00pm    
Based on the description, do you really need an inherited control for this? Why not just set the links on each linklabel and then register the same eventhandler for all linklabels. See the updated answer.

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