Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to display an image in a ShapeNode (Read 7110 times)
Rage
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 1
Joined: Aug 2nd, 2012
How to display an image in a ShapeNode
Aug 2nd, 2012 at 2:15pm
Print Post  
I use the Asp.net mvc MindFusion.diagramming component (the evaluation version) and I try to display an image in a ShapeNode but it does not work. The node is resized to the image dimensions but no image is displayed.

My code is the following (server side code):

DiagramView view = new DiagramView("diagramView1");
view.Width = 700;
view.Height = 500;

Diagram diagram = view.Diagram;
diagram.Font = new Font("Verdana", 3);
diagram.LinkBrush = new SolidBrush(Color.Black);
diagram.LinkHeadShape = ArrowHeads.Triangle;
diagram.LinkHeadShapeSize = 3;                                             

ShapeNode rootNode = diagram.Factory.CreateShapeNode(55, 10, 40, 15);            
rootNode.Text = captureService.Description;
rootNode.Image = Image.FromFile(@"D:\Project.Net\CaptureDashboard\Divers\Icons\telephone_256.png"
);            
rootNode.ImageAlign = MindFusion.Drawing.ImageAlign.Center;
rootNode.ResizeToFitImage();

Thanks for your help.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to display an image in a ShapeNode
Reply #1 - Aug 2nd, 2012 at 3:17pm
Print Post  
I think you should set the ShapeNode.ImageUrl property. The Image property is used only in the WinForms and ASP.NET versions of the control at this time.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Mark M.
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Apr 12th, 2013
Re: How to display an image in a ShapeNode
Reply #2 - Apr 12th, 2013 at 5:13am
Print Post  
Dear Stoyan,

         We are having the same problem as above. We tried using ImageUrl property but it still does not work. Below are a few scenarios we tried and none of them seemed to work:

1. Using ImageUrl:

                     var filePath = Server.MapPath(Url.Content("~/Images/NodeIcons/node-" + dataNode.data.SingleOrDefault(t => t.Key == "$type").Value + ".png"));
                        node.ImageUrl = filePath;
                        node.ImageAlign = MindFusion.Drawing.ImageAlign.Fit;
                        node.Transparent = true;

2. Loading Bitmap Image and assigning it

                        //Image nodeImage = new Bitmap(filePath);
                        //node.Image = node.Shape.Image = new Bitmap(filePath);
                        //node.Shape.ImageRectangle = new RectangleF(0, 0, 14, 14);

Value for filepath during runtime is C:\Users\S2T\Desktop\Project1\WebApp\Images\NodeIcons\node-type2.png

        Kindly advise. Thanks very much in advance.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to display an image in a ShapeNode
Reply #3 - Apr 12th, 2013 at 5:32am
Print Post  
Hi,

ImageUrl should be specified as a remote path accessible by browsers; try with something like "./Images/NodeIcons/node-type2.png" or full URL (http://yoursite.com/images/...) instead of path on the local file system.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Mark M.
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Apr 12th, 2013
Re: How to display an image in a ShapeNode
Reply #4 - Apr 12th, 2013 at 6:07am
Print Post  
Thanks very much. They are showing now. =)
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint