VS2005 winform用户控件(一):入门篇
来源:互联网 发布:怎么删除mac上office 编辑:程序博客网 时间:2024/06/08 06:06
VS2005 winform用户控件入门一
本例用于用户控件的初学者参考。
创建一个最简单的用户控件,该控件扩展现有的textbox的功能:
要完成的功能是:当textbox中输入时,用MessageBox显示textbox的内容。
一、创建一个用户控件项目:新建项目/windows项目/windows控件库。即可创建一个用户控件的模板。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace WindowsControlLibrary1
{
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
}
}
二、在新创建的“UserControl1”设计器上添加一个TextBox.
三、注册TextChanged事件,交添加TextChanged事件的代码:
private void UserControl1_Load(object sender, EventArgs e)
{
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
}
private void textBox1_TextChanged(object sender, System.EventArgs e)
{
MessageBox.Show(this.textBox1.Text);
}
四、编译你的控件项目,生成一个DLL文件。
五、新建一个Windows项目。
六、在工具栏中“选择项”,然后点击“浏览”,选择你编译的DLL文件,将控件添加到工具栏中。
七、将你新建的控件拖放到窗口中。即可。
- VS2005 winform用户控件(一):入门篇
- VS2005 winform用户控件(二):只能输入数字的textbox控件
- VS2005 winform用户控件(三):给控件添加新的属性
- C# WinForm控件(一)
- winform用户控件子控件访问权限
- WINFORM控件开发总结(一)
- WPF用户控件入门
- Winform用户控件添加WPF用户控件方法
- Winform基础入门(一)
- C# WinForm VS2005 动态添加并拖动控件
- Winform控件之DataGridView数据控件(一)
- C#的Winform中使用用户控件
- c#,winform,UserContrl,用户控件开发,窗体
- WinForm 用户控件 柱形图 折线图 饼图
- WinForm如何动态加载用户控件
- WinForm-用户控件的初始化顺序问题
- C# winform 用户控件布局变形
- C# WinForm中添加用户控件
- http://hi.csdn.net/heiyeshuwu/profile
- Easy Code v 1.01.0008 by Ramon Sala
- 采用各向异性过滤的前后对比及心得 (附图)
- Protect your applications against advanced reverse engineering and software cracking by AntiDebugLIB By Jim Charles
- 改进粒子系统-动态编译Shader
- VS2005 winform用户控件(一):入门篇
- Misc
- CSS 各种浏览器兼容方案
- 纯js操作div拖移/伸缩,拉动结束有渐变动画,支持快捷键
- vsftpd:匿名上传
- JavaScript Dom编程艺术
- WEB开发者的好消息
- Microsoft 和 Google 就Yahoo 收购一事展开口水战
- web标准亲身体验