linkbutton自定义控件 [英] linkbutton custom control
本文介绍了linkbutton自定义控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从windowslab应用程序的linklabel创建自定义控件链接按钮。
如何实现。
I want to create custom control linkbutton from the linklabel for the windows form application.
how it can be possible.
推荐答案
当然,你没有提到任何特定的担忧,所以也许首先阅读:开发自定义Windows窗体控件使用.NET Framework [ ^ ]
和几个例子:
- Divider面板 - 从Start到Toolbox创建自定义Windows窗体控件的教程 [ ^ ]
- 编写自定义控件:一步一步 [ ^ ]
增加:
使用多个链接标签的相同事件处理程序,您可以使用以下内容:
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:
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:
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.
这篇关于linkbutton自定义控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文