自定义控件中使用枚举类型的属性(原创)

来源:互联网 发布:windows mobile刷机包 编辑:程序博客网 时间:2024/05/03 03:12
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
brightview的专栏(原创

在控件中定义枚举类型属性

public enum DTableStateSelect
{
ShowAddnew = 1,
SaveAddnew = 2,
ShowEdit = 3,
SaveEdit = 4,
Delete = 5,
Show = 6,
List = 0
}


private DTableStateSelect _DTableState; //定义类的私有变量,变量的类型为上面定义的枚举

public DTableStateSelect DTableState //定义属性,变量的类型为上面定义的枚举
{
get
{
return _DTableState;
}
set
{
_DTableState = value;
}
}


在页面设置控件的枚举类属性

DTable1.DTableState = DTableControl.DTable.DTableStateSelect.List;

当然,也可以在设计界面的属性栏直接选择属性的不同类型

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击