Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Image cropped while zooming in diagram (Read 4655 times)
Yogendra
Junior Member
**
Offline


I Love MindFusion!

Posts: 68
Joined: Dec 27th, 2012
Image cropped while zooming in diagram
Dec 27th, 2012 at 2:40pm
Print Post  
Hello Guys,
I am using Diagram control in silverlight in an application I am creating. The control is pretty cool Cool but I am facing a problem when I implement zooming.
Actually I have an image assigned to diagram's background using:

Dim WithEvents BGNode As MindFusion.Diagramming.Silverlight.ContainerNode
Dim shape As ShapeNode = BGNode
shape.Image = bitmap
'here setting the image

Now I have to zoom inside the diagram, for that case I am resetting the width and height of the diagram as per the zoom factor.
[/color]
It works absolutely fine when I set "ImageAlign" of "shape" other than none. In case "ImageAlign" is set as None:

[color=#ff0000]shape .ImageAlign = Stretch.None


When zoomed now, the image crops Sad.

Please suggest some way to overcome this problem Undecided . Thanks in advance.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Image cropped while zooming in diagram
Reply #1 - Dec 27th, 2012 at 3:01pm
Print Post  
Hi,

The type of the ImageAlign property is the ImageAlign enumeration, which does not contain a None member. Doesn't VB.NET show some kind of warning when you try to assign that value? Stretch.None might not have a corresponding value in ImageAlign, and then the image alignment code would get skipped. In any case, you can see the supported values here:
http://www.mindfusion.eu/onlinehelp/diagramlite/index.htm?T_MindFusion_Diagrammi...

Also if you are resizing the diagram to match the zoom level, you might have to resize the background node too by setting backnode.Bounds = diagram.Bounds.

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


I Love MindFusion!

Posts: 68
Joined: Dec 27th, 2012
Re: Image cropped while zooming in diagram
Reply #2 - Jan 22nd, 2013 at 5:58am
Print Post  
Thanks  Smiley but it did not work.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Image cropped while zooming in diagram
Reply #3 - Jan 22nd, 2013 at 10:53am
Print Post  
This works in my test:

Code
Select All
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
	var backNode = diagram.Factory.CreateShapeNode(diagram.Bounds);
	backNode.ImageAlign = ImageAlign.Stretch;
	backNode.Image = new BitmapImage(new Uri(
		"test_image.jpg", UriKind.Relative));
	backNode.Locked = true;
}

private void OnDoubleSize(object sender, RoutedEventArgs e)
{
	var newBounds = diagram.Bounds;
	newBounds.Width *= 2;
	newBounds.Height *= 2;
	diagram.Bounds = newBounds;
	diagram.Nodes[0].Bounds = newBounds;
} 

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint