为自定义列表框实现“编辑项目设计器"动词 [英] Implementing Edit items designer verb for a custom listbox

查看:76
本文介绍了为自定义列表框实现“编辑项目设计器"动词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我打算创建一个列表框类型的usercontrol.我想知道如何使用自定义设计器类实现编辑项设计器动词,以便在设计时可以将项添加"到用户控件...

请帮帮我


我添加了添加",因为句子中似乎缺少一个单词. DMA

Hi all,
I am planning to create a listbox type usercontrol. I would like to know how to implement edit items designer verb using custom designer class so that I can ''Add'' items to the user control during design time...

Please help me


edit: I added the ''Add'' as there appeared to be a word missing in the sentence. DMA

推荐答案

如果您谈论的是WinForms:关于如何在自定义控件中添加对Actions和Designer Verbs之类的设计时支持的最佳系统解释我遇到过的是Matthew MacDonald的2004版"C#中的Pro .NET 2.0 Windows窗体和自定义控件"(APress).

在CP上签出:[ ^ ].

在MSDN上:[ ^ ]

恕我直言,这是一项艰巨的任务.

您可能会记住,定义一个公共枚举,然后将一个公共属性放在您的自定义控件中,类型是该公共枚举的类型将导致在属性编辑器中出现在设计时 ...针对该自定义控件的实例,将其拖动到属性"编辑器中该条目的ComboBox选择中的窗体"上.

那是一个轻松的胜利.
If you are talking about WinForms: the best systematic explanation of how you go about adding design-time support for things like Actions and Designer Verbs in a custom control I''ve come across is in the 2004 edition of Matthew MacDonald''s "Pro .NET 2.0 Windows Forms and Custom Controls in C#" (APress).

On CP check out:[^].

On MSDN:[^]

This is, imho, a non-trivial task.

You might keep in mind that defining a public Enum, and then putting a public property in your custom control, whose type is the type of that public Enum will result in the presence in the Properties Editor at design-time ... for an instance of that custom control dragged onto a Form ... in a ComboBox selection for that entry in the Properties Editor.

That''s an easy win.


这篇关于为自定义列表框实现“编辑项目设计器"动词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆