We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Change bitmap in node on mouse click

Thread ID:

Created:

Updated:

Platform:

Replies:

98987 Apr 14,2011 09:37 AM Mar 4,2018 11:59 PM Windows Forms 3
loading
Tags: Diagram
Tom Fitzmorris
Asked On April 14, 2011 09:37 AM

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...


Pandi Murugan A [Syncfusion]
Replied On April 19, 2011 03:03 AM

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


vinodkumar
Replied On March 3, 2018 10:28 AM

yes

Naganathan Ganesh Babu [Syncfusion]
Replied On March 4, 2018 11:59 PM

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;