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
> 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
[quoted text clipped - 9 lines]
>
> Bill
Bill Henning - 24 Jun 2004 23:27 GMT
Thanks Jerron... that works!
> Hi Bill,
>
[quoted text clipped - 57 lines]
> >
> > Bill