Change bitmap in node on mouse click

Need to be able to change the bitmap in the selected node on mouse click to simulate an on off state.(light switch / lamp etc.)
I can trap the events. just need help for changing the bitmap if it is even possible thanks...


3 Replies

PM Pandi Murugan A Syncfusion Team April 19, 2011 07:03 AM UTC

Hi Tom,

Thanks for using Syncfusion products.

We suggest you to set the BitmapNode's Image property to achieve your requirements. Please refer the below code snippet.

[C#]
private void Form1_Load(object sender, EventArgs e)
{
BitmapNode bmpNode = new BitmapNode(@"..\\..\\desert.jpg");
bmpNode.Size = new SizeF(200, 100);
bmpNode.PinPoint = new PointF(300, 100);
diagram1.Model.AppendChild(bmpNode);
//add event for nodeclick
diagram1.EventSink.NodeClick += new NodeMouseEventHandler(EventSink_NodeClick);
}

void EventSink_NodeClick(NodeMouseEventArgs evtArgs)
{
if (evtArgs.Node != null && evtArgs.Node is BitmapNode)
{
//Change the bitmap
((BitmapNode)evtArgs.Node).Image = new Bitmap(@"..\\..\\koala.jpg");
}
}


Please let me know if you have any concerns.

Regards,
Pandi Murugan A



VI vinodkumar March 3, 2018 03:28 PM UTC

yes


NG Naganathan Ganesh Babu Syncfusion Team March 5, 2018 04:59 AM UTC

Hi Tom, 
 
Thanks for the update please let us know whether you need any further assistance  
 
Regards, 
 
Naganathan K G 


Loader.
Up arrow icon