组件编程(3) Property Editor

本文介绍了Property Editor组件的使用,展示了其效果。提供源代码下载,帮助理解组件编程。
摘要由CSDN通过智能技术生成
       上一章遗留的DefaultValueAttribute问题,还没有找到问题所在,我会继续查找资料,找到后会及时补上。
        今天我们讲Component  Property Editor UI,在vs环境中Property Editor有两种,一种是vs自带的,一种是Component编写者根据自己需求而重新编写的。在本章中我们这两种都会进行一个简单的学习,vs自带的主要讲Collection Editor。
        先来回顾下我们上章没有讲的几个PropertyAttribute:
        EditorAttribute:指定Property Editor使用的编辑器。
        DesignerSerializationVisibilityAttribute:指定通过Property Editor得到的结果是否保存在代码中。
        LocalizableAttribute:用户要本地化某个窗体时,任何具有该特性的属性都将自动永久驻留到资源文件中。
        代码实例如下,请注意代码中注释说明。

using  System;
using  System.Collections.Generic;
using  System.Collections;
using  System.Text;
using  System.ComponentModel;
using  System.ComponentModel.Design;
using  System.Drawing;
using  System.Drawing.Design;
using  System.Windows.Forms;
using  System.Windows.Forms.Design;

namespace  Components
{
    
// 这个例子用到了vs 2005里的List<>,如果vs 2003的朋友请自己去实做StudentCollection。
    
// 只要让Property的类型为继承IList的类型,其Property Editor UI都可以用vs自带的。
    public class Demo3 : Component
    
{
        
public Demo3()
        
{
            _students 
= new 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值