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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Get resource path form BitmapNode

Thread ID:

Created:

Updated:

Platform:

Replies:

146164 Jul 23,2019 06:56 PM UTC Jul 25,2019 10:38 AM UTC WinForms 3
loading
Tags: Diagram
George
Asked On July 23, 2019 06:56 PM UTC

Hi ,
I am looking to get the path of the source image for the BitmapNode, but I wasn't able to find any property with such value

Ramya Thirugnanam [Syncfusion]
Replied On July 24, 2019 07:14 AM UTC

Hi George,  
 
Please use the below code example to get an Image location. By default, the path gets accessed from bin folder and if you need to access the folder location, you should Rightclick on image -> click properties -> Copy to Output Directory as Copy always. Please refer to a screenshot below.  
 
Code example:  
// Get the location of image  
   string filePath = Path.Combine(Environment.CurrentDirectory, "Images\\personico.bmp");  
 
 
 
Here is the link to get an image path.  
 
screenshot:  
 
  
 
please refer to the code example below render  an image node.  
 
Code example:  
// Get an location of image  
   string filePath = Path.Combine(Environment.CurrentDirectory, "Images\\personico.bmp");  
  // Set an filepath to bitmap class  
 Bitmap bitmap = new Bitmap(filePath);  
 //Render an image Node  
BitmapNode image = new BitmapNode(bitmap, new RectangleF(0, 0, 100, 50));  
diagram1.Model.AppendChild(image);    
 
 
 
Regards,  
Ramya T  


George
Replied On July 24, 2019 03:27 PM UTC

I create the BitmapNode at runtime and the user is free to select any image he wants
I wouls also get the Image path at runtime if possible

Ramya Thirugnanam [Syncfusion]
Replied On July 25, 2019 10:38 AM UTC

Hi George,  
 
Please use Diagram “BitmapTool” to activate the tool and create the BitmapNode at runtime. While creating the BitmapNode using Diagram tool at runtime, the dialog box will appear and select the image anywhere from the machine. Please refer to the below attached sample.  
 
Sample:  
Sample  
 
Regards, 
Ramya T 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon