hello guys,
i'm currently trying to implement a mouselistener into an grasshopper component, but i'm a little bit lost.
i wrote a small testclass and implemented it in my component and everything works just fine when the mouslistener is out-commentated. when not, grasshopper throws an exception by the target of inovacation at startup.
below the mouselistener test class:
class test
{
private String state= "start";
private System.Windows.Forms.MouseEventHandler MouseDown;
public test()
{
this.MouseDown += new System.Windows.Forms.MouseEventHandler(Form_MouseDown);
}
public string getState()
{
return state;
}
protected void Form_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
switch (e.Button)
{
case System.Windows.Forms.MouseButtons.Left:
this.state= "left last";
break;
case System.Windows.Forms.MouseButtons.Right:
this.state= "right last";
break;
case System.Windows.Forms.MouseButtons.Middle:
this.state= "middle last";
break;
}
}
}
every suggestion would be great
Tags: