Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic The Diagram's grid painting position is wrong. (Read 1768 times)
chowy
Junior Member
**
Offline


I Love MindFusion!

Posts: 72
Joined: May 8th, 2017
The Diagram's grid painting position is wrong.
Aug 11th, 2017 at 2:04am
Print Post  
When I initialize, set Diagram.Zoomfactor to 632, grid will be biased.I have already called Diagram.InvalidateBackground (),but it does not work.I have uploaded the demo source.
  

WpfApplication9.zip ( 44 KB | 236 Downloads )
DiagramGird.png ( 4 KB | 88 Downloads )
DiagramGird.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: The Diagram's grid painting position is wrong.
Reply #1 - Aug 11th, 2017 at 6:54pm
Print Post  
InvalidateBackground won't work before the diagram's template is applied. Set zoom factor from the Window.Loaded event handler and it will align the zoomed grid correctly -

Code
Select All
public MainWindow()
{
    InitializeComponent();
    Loaded += (s, e) => { Diagram.ZoomFactor = 632; };
}

private void Diagram_OnZoomFactorChanged(object sender, EventArgs e)
{
    Diagram.InvalidateBackground();
}

private void Diagram_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
    Diagram.ZoomFactor = Math.Min(1000, Diagram.ZoomFactor + 10);
} 



Regards,
Slavcho
  
Back to top
 
IP Logged
 
chowy
Junior Member
**
Offline


I Love MindFusion!

Posts: 72
Joined: May 8th, 2017
Re: The Diagram's grid painting position is wrong.
Reply #2 - Aug 15th, 2017 at 1:41am
Print Post  
Slavcho wrote on Aug 11th, 2017 at 6:54pm:
InvalidateBackground won't work before the diagram's template is applied. Set zoom factor from the Window.Loaded event handler and it will align the zoomed grid correctly -

Code
Select All
public MainWindow()
{
    InitializeComponent();
    Loaded += (s, e) => { Diagram.ZoomFactor = 632; };
}

private void Diagram_OnZoomFactorChanged(object sender, EventArgs e)
{
    Diagram.InvalidateBackground();
}

private void Diagram_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
    Diagram.ZoomFactor = Math.Min(1000, Diagram.ZoomFactor + 10);
} 



Regards,
Slavcho

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