Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Differences between WPF and Windows Forms (Read 3937 times)
Homam
Junior Member
**
Offline


I Love MindFusion!

Posts: 67
Joined: Feb 7th, 2012
Differences between WPF and Windows Forms
Dec 9th, 2012 at 12:15pm
Print Post  
The following image is for the same diagram which has been saved in a Windows Forms application and opened in a WPF application.

1. Why has the round shown around the node in WPF?
2. The image didn't save its resolution

  

0099.png (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Differences between WPF and Windows Forms
Reply #1 - Dec 10th, 2012 at 6:59am
Print Post  
If this is a TableNode, set smaller Diagram.RoundRectFactor in WPF to get smaller corner arcs. Are you referring to the resolution of the arrow image in caption bar? I can't see any difference between the two images.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Homam
Junior Member
**
Offline


I Love MindFusion!

Posts: 67
Joined: Feb 7th, 2012
Re: Differences between WPF and Windows Forms
Reply #2 - Dec 10th, 2012 at 7:29am
Print Post  
1. It's a ShapeNode.
2. The whole shape you're seeing is a PNG image including the header and the image and title. It lost its resolution in WPF.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Differences between WPF and Windows Forms
Reply #3 - Dec 10th, 2012 at 11:24am
Print Post  
1. If using the RoundRect shape and millimeter units, try setting the following when initializing the diagram:

Shapes.RoundRect.Outline[0] = new RoundRectangleTemplate(0, 0, 100, 100, 3);

This makes the corner radius of all rounded rect shapes 3 millimeters, the same as in WinForms.

2. Is this a static image assigned to the node's Image property, or are you generating the image dynamically?
  
Back to top
 
IP Logged
 
Homam
Junior Member
**
Offline


I Love MindFusion!

Posts: 67
Joined: Feb 7th, 2012
Re: Differences between WPF and Windows Forms
Reply #4 - Dec 10th, 2012 at 12:51pm
Print Post  
These are the images I'm using
  

adminStep.png (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Differences between WPF and Windows Forms
Reply #5 - Dec 11th, 2012 at 7:52am
Print Post  
It seems WPF renders images a bit blurry if they are not at exact integer coordinates in pixels, which would happen in your case when the scale for millimeter unit is applied. You could align nodes to pixels as shown below, the images look better then:

Code
Select All
var imgWidth = GraphicsUnit.WpfPoint.Convert(image.PixelWidth, diagram.MeasureUnit);
var imgHeight = GraphicsUnit.WpfPoint.Convert(image.PixelHeight, diagram.MeasureUnit);
node.Resize(imgWidth, imgHeight);

var p = diagram.DocToClient(node.Bounds.Location);
p.X = Math.Round(p.X);
p.Y = Math.Round(p.Y);
p = diagram.ClientToDoc(p);
node.Move(p.X, p.Y); 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint