System.Drawing.Design.UITypeEditor自定义控件属性GetEditStyle(ITypeDescriptorContext context),EditValue(ITyp...

    • using System;
    • using System.Collections.Generic;
    • using System.Linq;
    • using System.Text;
    • using System.ComponentModel;
    • namespace xmlTojson
    • {
    • [Editor(typeof(MyTestUITypeEditor),typeof(System.Drawing.Design.UITypeEditor))]
    • [Browsable(true)]
    • public class MyTestProperty
    • {
    • #region Property
    • /// <summary>
    • /// 姓名
    • /// </summary>
    • private string _Name = null;
    • public string Name
    • {
    • get { return _Name; }
    • set { _Name = value; }
    • }
    • /// <summary>
    • /// 性别
    • /// </summary>
    • private string _Sex = null;
    • public string Sex
    • {
    • get { return _Sex; }
    • set { _Sex = value; }
    • }
    • /// <summary>
    • /// 年龄
    • /// </summary>
    • private string _Age = null;
    • public string Age
    • {
    • get { return _Age; }
    • set { _Age = value; }
    • }
    • #endregion
    • }
    • }
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.ComponentModel;
  6. using System.Drawing.Design;
  7. namespace xmlTojson
  8. {
  9. [System.Runtime.InteropServices.ComVisible(true)]
  10. public class MyTestUITypeEditor : UITypeEditor
  11. {
  12. public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
  13. {
  14. //return base.GetEditStyle(context);
  15. return UITypeEditorEditStyle.Modal;
  16. }
  17. public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
  18. {
  19. //return base.EditValue(context, provider, value);
  20. return value;
  21. }
  22. }
  23. }
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值