Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Offsetting the diagram BackgroundImage? (Read 1715 times)
ulthien
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 91
Location: Munich
Joined: Nov 29th, 2011
Offsetting the diagram BackgroundImage?
May 10th, 2013 at 4:01pm
Print Post  
Hello,

trying to offset the background image of a diagram so its raster fits to nodes spacing:

<Presentation:DetailDiagram x:Name="NetDiagram" BackgroundImage="{StaticResource Cell_Grid}"
BackgroundImageAlign="Tile"

Focusable="False"
ShowAnchors="Auto"
BackBrush="{StaticResource DefaultBackgroundBrush}"
AlignToGrid="True"
GridSizeX="1"
GridSizeY="1"
ShapeHandlesStyle="HatchHandles3"
ShowGrid="False"
Behavior="DrawLinks"
ShapeBrush="DeepSkyBlue"
AllowDrop="True"
>

but there is no margin="" element to nudge the positioning of the background a bit, like 20 pixels...

repositionining the nodes themselves gets overriden, as somehow the backgroundimage "adapts" and jumps to same position again..
  
Back to top
 
IP Logged
 
ulthien
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 91
Location: Munich
Joined: Nov 29th, 2011
Re: Offsetting the diagram BackgroundImage?
Reply #1 - May 10th, 2013 at 4:45pm
Print Post  
actually, the behaviour of the diagram background is different depending if i take

BackgroundImageAlign="Centered" or anything else.

Only Centered stays proportionally and positionally same on zooming in and out, all others scale wrong or slide aside.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Offsetting the diagram BackgroundImage?
Reply #2 - May 11th, 2013 at 8:29am
Print Post  
You can draw an image with offset from the DrawBackground event handler:

Code
Select All
private void OnDrawBackground(object sender, DiagramEventArgs e)
{
	var img = Utilities.LoadImage("test.png");
	var rect = new Rect(160, 20, img.Width, img.Height);
	e.Graphics.DrawImage(img, rect);
} 



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