如何在我自己的自定义控件中实现以下功能:
对于上下文菜单,用户Reza指出了我正确的方向:使用verbs
internal class MyDesigner : ComponentDesigner
{
DesignerVerbCollection m_Verbs;
// DesignerVerbCollection is overridden from ComponentDesigner
public override DesignerVerbCollection Verbs
{
get
{
if (m_Verbs == null)
{
// Create and initialize the collection of verbs
m_Verbs = new DesignerVerbCollection();
m_Verbs.Add( new DesignerVerb("First Designer Verb", new EventHandler(OnFirstItemSelected)) );
m_Verbs.Add( new DesignerVerb("Second Designer Verb", new EventHandler(OnSecondItemSelected)) );
}
return m_Verbs;
}
}
}
对于文本框,我玩弄了覆盖GetHitTest然后显示文本框。但我之后无法编辑它......