c# - 如何在 WinForms 设计器中隐藏自定义属性中的某些对象?
问题描述
我有一个UserControl
包含例如一个属性
public Button TargetButton { get; set; }
还包含UserControl
例如 3 个按钮。
现在我有一个继承自此的主 UI 或控件UserControl
UI 控件有一个Button
. 现在我认为 PropertyGrid 或 VS Desginer 中的 TargetButton 将只显示 UiControl 中的按钮。但实际上它显示了所有按钮。UI 控件的核心按钮UserControl
和普通按钮。
如何从 PropertyGrid 或 VS Designer TargetButton 属性选择列表中排除 UserControl 的按钮?
例如: UserControl 中的属性如
[TypeConverter(ExcludeObjects(coreBtn1, coreBtn2 ))]
所以我只需要阻止我的属性在基本用户控件上选择核心按钮。但只有我可以在继承自 UserControl 的 Main Control 或 UIControl 中选择一个按钮
解决方案
推荐阅读
- oracle - 我收到(由于初始化提供程序时出错,测试连接失败)错误:E_UNEXPECTED(0x8000FFFF)。关于 OLE DB 的 oracle 提供程序
- async-await - 外部 Http 调用上的无服务器框架/Lambda 错误
- laravel - Laravel 6,计算每个部门的员工人数
- javascript - 如何将数据发布到后端服务器以存储到数据库中?
- node.js - 在 nodejs 模块中运行 newman
- java - System.out.print("Calculator") 后跟 Scanner 或 BufferReader 时不显示输出,后者在 IntelliJ IDEA 中采用 System.in
- variables - 关于 grails 域类变量的简单问题
- javascript - 如何通过过渡打开/关闭文本?
- java - 如何使用各自的模式验证整个 json 以便在 java 中集成
- java - 如何在 jboss 中修复“IJ000305:发生连接错误”