Hi Bill,
I'm doing something like this in my custom controls designer
I didn't try compiling it but I just modified it from some of my code
so hopefully it works.
private DesignerVerb SomeVerb;
public override void Initialize(IComponent component)
{
base.Initialize (component);
ISelectionService ss =
(ISelectionService)GetService(typeof(ISelectionService));
if (ss != null)
ss.SelectionChanged += new EventHandler(OnSelectionChanging);
this.SomeVerb = new DesignerVerb("Invoke SomeVerb", new
EventHandler(SomeVerbHandler));
}
public void OnSelectionChanging(object sender, EventArgs e)
{
ISelectionService ss =
(ISelectionService)GetService(typeof(ISelectionService));
if( ss.PrimarySelection is Button ||
ss.PrimarySelection is Label
{
IDesignerHost dh = (IDesignerHost)
this.GetService(typeof(IDesignerHost));
IDesigner dsgnr = (IDesigner)dh.GetDesigner(
(Control)ss.PrimarySelection );
if( !dsgnr.Verbs.Contains() )
dsgnr.Verbs.Add(SomeVerb);
}
}
private void SomeVerbHandler(object sender, EventArgs e)
{
MessageBox.Show("Do Something");
}
kind regards,
Jerron
[quoted text, click to view] "Bill Henning" <please @ nospamforactiprosoftware.com> wrote in message news:<Oc3dhtEWEHA.4048@TK2MSFTNGP10.phx.gbl>...
> Does anyone know if it is possible to add verbs in the designer to controls
> that are NOT created by me? For instance, whenever the user has an instance
> of one of my manager components on their form and selects a control (such as
> a Button, Label, or any other control not created by me), I would like to
> add a verb "Do Something" to that Control's context menu and have it visible
> in the verb area in the property grid.
>
> Is this possible? I believe Infragistics does this with their controls but
> I haven't found any help on how to implement it.
>
> Thanks for your help.
>