如何通过 .NET 在组件属性窗口中创建并监听按钮?
.NET插件编程实战:如何在组件属性窗口创建并监听自定义按钮 - .Net Add-on Programming
2026-04-21
新闻来源:网淘吧
围观:8
电脑广告
手机广告
.NET 插件编程
请帮帮我![]()
有什么建议吗?
如果你只需要一个简单的按钮,可以为组件添加按钮属性(IButtonProperty)并注册其OnClick事件。
@TSy,能否提供一个具体实现的示例?
截至目前已尝试但未成功的方法:
ISimComponent comp= e.Component.RootNode.Component;
IButtonProperty button = (IButtonProperty)comp.CreateProperty(typeof(ButtonType), PropertyConstraintType.NotSpecified, "myButton");
IProperty<ButtonType> button = (IProperty<ButtonType>)comp.CreateProperty(typeof(ButtonType), PropertyConstraintType.NotSpecified, "myButton");
我目前在使用 .NET API 创建简单按钮时也遇到了困难。
有人能提供一个简单示例吗?
var button = (IButtonProperty)comp.CreateProperty(typeof(IButtonProperty), PropertyConstraintType.AllValuesAllowed, "btn");
1个赞
文章底部电脑广告
手机广告位-内容正文底部


微信扫一扫,打赏作者吧~







