Hi,
I was trying to use the above named method. My question is how to set the image in the (ToolStrip, String, EventHandler, Image, Boolean, Boolean) overload just when the item is selected like int he Bounding Box native component.
My attempt so far with the use of the explanation from James Ramsden here: http://james-ramsden.com/append-menu-items-to-grasshopper-components-with-c/
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
}
protected override void AppendAdditionalComponentMenuItems(System.Windows.Forms.ToolStripDropDown menu)
{
base.AppendAdditionalComponentMenuItems(menu);
Menu_AppendItem(menu, "Flip myBool", Menu_DoClick, ToolTipTest.Properties.Resources.arcArrayIconNeu,false);
base.AppendAdditionalComponentMenuItems(menu);
Menu_AppendItem(menu, "Flip myBool", Menu_DoClick, ToolTipTest.Properties.Resources.arcArrayIconNeu, false);
}
private void Menu_DoClick(object sender, EventArgs e)
{
myBool = !myBool;
}
public bool myBool = false;
/// <summary>
/// Registers all the output parameters for this component.
/// </summary>
protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
}
/// <summary>
/// This is the method that actually does the work.
/// </summary>
/// <param name="DA">The DA object can be used to retrieve data from input parameters and
/// to store data in output parameters.</param>
protected override void SolveInstance(IGH_DataAccess DA)
{
if (myBool == true)
{
Message = ("1");
}
else
{
Message = ("2");
}
ExpireSolution(true);
}
Thanks for everybody taking time looking on it.
Regards!