zoukankan
html css js c++ java
c#,winform,UserContrl,用户控件开发,窗体 Virus
用户控件效果如上图
代码如下:
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
event
EventHandler AddressLine1Changed;
public
event
EventHandler AddressLine2Changed;
public
event
EventHandler ZoneChanged;
public
event
EventHandler NumberChanged;
private
void
TextBoxControls_TextChanged(
object
sender, EventArgs e)
{
switch
(((TextBox)sender).Name)
{
case
"
txtAddress1
"
:
if
(AddressLine1Changed
!=
null
)
{
AddressLine1Changed(
this
, EventArgs.Empty);
}
break
;
case
"
txtAddress2
"
:
if
(AddressLine2Changed
!=
null
)
AddressLine2Changed(
this
, EventArgs.Empty);
break
;
case
"
txtZone
"
:
if
(ZoneChanged
!=
null
)
ZoneChanged(
this
, EventArgs.Empty);
break
;
case
"
txtNumber
"
:
if
(NumberChanged
!=
null
)
NumberChanged(
this
, EventArgs.Empty);
break
;
}
}
[Category(
"
NumberData
"
), DescriptionAttribute(
"
Gets or sets the Number value
"
), DefaultValue(
""
)]
public
string
Number
{
get
{
return
this
.txtNumber .Text; }
set
{
if
(txtNumber.Text
!=
value)
{
txtNumber.Text
=
value;
if
(NumberChanged
!=
null
)
NumberChanged(
this
, PropertyChangedEventArgs.Empty);
}
}
}
[Category(
"
AddressData
"
), DescriptionAttribute(
"
Gets or sets the AddressLine1 value
"
), DefaultValue(
""
)]
public
string
AddressLine1
{
get
{
return
txtAddress1.Text; }
set
{
if
(txtAddress1.Text
!=
value)
{
txtAddress1.Text
=
value;
if
(AddressLine1Changed
!=
null
)
AddressLine1Changed(
this
, PropertyChangedEventArgs.Empty);
}
}
}
[Category(
"
AddressData
"
), DescriptionAttribute(
"
Gets or sets the AddressLine2 value
"
), DefaultValue(
""
)]
public
string
AddressLine2
{
get
{
return
txtAddress2.Text; }
set
{
if
(txtAddress2.Text
!=
value)
{
txtAddress2.Text
=
value;
if
(AddressLine2Changed
!=
null
)
AddressLine2Changed(
this
, PropertyChangedEventArgs.Empty);
}
}
}
[Category(
"
ZoneData
"
), DescriptionAttribute(
"
Gets or sets the Zone value
"
), DefaultValue(
""
)]
public
string
Zone
{
get
{
return
txtZone.Text; }
set
{
if
(txtZone.Text
!=
value)
{
txtZone.Text
=
value;
if
(ZoneChanged
!=
null
)
ZoneChanged(
this
, PropertyChangedEventArgs.Empty);
}
}
}
public
UserControl1()
{
InitializeComponent();
}
}
}
【Blog】
http://virusswb.cnblogs.com/
【MSN】
jorden008@hotmail.com
【说明】转载请标明出处,谢谢
反馈文章质量,你可以通过快速通道评论:
查看全文
相关阅读:
linux学习(一)
Linux学习(用户管理)
anyproxy mac安装
python mitmproxy 代理
Js常用方法map, sort
echarts常用配置项【持续更新】
【转】moment js 使用
js Cannot assign to read only property 'exports' of object '#<Object>' at Modul,import 与module.exports混用问题
a标签跳转referer漏洞
element ui rate评分组建使用
原文地址:https://www.cnblogs.com/virusswb/p/1206914.html
最新文章
FIR滤波器资源占用率
WiFi6循环前缀长度的选择
WiFi6子载波间隔的选择
时钟晶振精度
IEEE 802.11 Documents
dBx概念及区别
循环矩阵傅里叶对角化
JQ 文本框只能输入正数字
C# 简单粗暴写日志
笔记3
热门文章
笔记2
笔记1
Blazor 调用api
Linux学习(用户组)
blazor 中没有 blazor WebAssembly App 模板
ASP.NET Core 自带IOC容器如何依赖注入
EF core 从数据库中获取实体模型
Git 提交和获取代码
Linux学习(三)
Linux学习(二)
Copyright © 2011-2022 走看看