We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Disable Diagram.View magnification ability


Inkeddiagram.jpg 


Hello there!

Im using this version for WinForms Application with C# : 20.3.0.56

Have a problem with zooming in diagram and view 
I need that user Could not do any action out of the diagram Range 
like photo attached I wanted diagram and the workspace to be In Blue Lined Range NOT like The red one 

maybe disable zooming or Scale !!!I do not Know How reach this purpose!!

Best Regards 

Mohammad 


10 Replies 1 reply marked as answer

DT Deepa Thiruppathy Syncfusion Team December 9, 2022 12:55 PM UTC

Hi Mohammad,


We are working on your requirement. We will update the details on or before December 12, 2022.



DT Deepa Thiruppathy Syncfusion Team December 13, 2022 11:25 AM UTC

Hi Mohammad,


Requirement: How to fill diagram to the window


You can set the document size of the diagram as window size using Resize event of Form.


Code snippet:

private void Form1_Resize(object sender, EventArgs e)

{

    diagram1.Model.DocumentSize = new Syncfusion.Windows.Forms.Diagram.PageSize(this.Width - 10, this.Height - 10);

    diagram1.Width = this.Width;

    diagram1.Height = this.Height;

}


We have created a simple sample for your reference as below,

https://www.syncfusion.com/downloads/support/directtrac/general/ze/DiagramFillToWindow240400761



Regards,

Deepa Thiruppathy


Note: If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.



MO mohammad replied to Deepa Thiruppathy December 14, 2022 08:08 AM UTC

thank for reply

Actually I dont need to fill diagram to the window!!!
I need to Diagram.Model fill the Diagram without Possibility
Zooming or scale changings
I need this to be Fixed in Diagram

like image attached : Diagram.Model should fixed in gray environment 1.JPG 
(Note : I have multiple Diagrams in my form under each Other that each diagram have Its Own Model)


thanks !



DT Deepa Thiruppathy Syncfusion Team December 15, 2022 12:37 PM UTC

Hi Mohammad,


Requirement: How to fill diagram to its view area


We have modified the sample with multiple diagram page, and we have updated the diagram model size as document size in the form loaded event.


Code snippet:

//Setting diagram model size as diagram window size

private void Form_loaded(object sender, EventArgs e)

{

    diagram1.Model.DocumentSize = new PageSize(diagram1.Size.Width, diagram1.Size.Height);

    diagram1.Width = diagram1.Size.Width;

    diagram1.Height = diagram1.Size.Height;

 

    diagram2.Model.DocumentSize = new PageSize(diagram2.Size.Width, diagram2.Size.Height);

    diagram2.Width = diagram2.Size.Width;

    diagram2.Height = diagram2.Size.Height;

 

    diagram3.Model.DocumentSize = new PageSize(diagram3.Size.Width, diagram3.Size.Height);

    diagram3.Width = diagram3.Size.Width;

    diagram3.Height = diagram3.Size.Height;

}


Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/DiagramFillToWindowModified-1790547431


If we misunderstood your requirement, then please share any video representation of your requirement.



MO mohammad replied to Deepa Thiruppathy December 17, 2022 08:55 AM UTC

Hi  Deepa 
thanks a lot

your code somehow worked BUT still there are some issues :

1- I want to load my Custom diagram Built with Diagram Builder - when I load it your code did not Work !!!!!
(section 2 in picture) 

2- In section 1 in picture your code works fine but I need to user could Not Be able to change with Zoom or Pan
how can I achieve this !!!
213123.JPG
 
thank a lot again. 



DT Deepa Thiruppathy Syncfusion Team December 20, 2022 02:49 PM UTC

Hi Mohammad,


We need some more clear details from your side for all your queries,


Query

Response

1- I want to load my Custom diagram Built with Diagram Builder - when I load it your code did not Work !!!!!
(section 2 in picture) 

We understood that you are trying to save a diagram from simple application and loading it later in the diagram builder application. If so, can you share your saved diagram to us. If we misunderstood your query, then please explain your issue clearly.  

2- In section 1 in picture your code works fine but I need to user could Not Be able to change with Zoom or Pan
how can I achieve this !!!

We are not getting you statement. Do you want to disable the zoom and pan operation on the page, or do you want to maintain the same page and document size when doing zoom and pan? please explain your requirement clearly. 



MO mohammad replied to Deepa Thiruppathy December 24, 2022 06:12 AM UTC

Hi Deepa 

1- first I made A CustomDiagram.edd File using DiagramBuilder.exe 

    then Im gonna Load my CustomDiagram.edd in My Windows Form Application

    using ==> diagram.LoadBinary(FilePath)

    then using your code to set size of diagram's Document   BUT It did not Work

    (*I Attach my CustomDiagram.edd file)



 2 - I want to disable Zoom And Pan operations totally that user of my form will not be able to zoom and pan the page!!!


Attachment: NewDiagram_fd3be981.rar


DT Deepa Thiruppathy Syncfusion Team December 29, 2022 02:41 PM UTC

Hi Mohammad,


Please find below response table for all your queries,


Query

Response

1- first I made A CustomDiagram.edd File using DiagramBuilder.exe 

    then Im gonna Load my CustomDiagram.edd in My Windows Form Application

    using ==> diagram.LoadBinary(FilePath)

    then using your code to set size of diagram's Document   BUT It did not Work

    (*I Attach my CustomDiagram.edd file)

 

Reported issue:  How to fill diagram to the window after loading new file

 

To fix this issue, we suggest using below code to fill the diagram to the window after loading new diagram file.

Code snippet:

diagram1.View.MouseTrackingEnabled = true;

diagram1.View.Origin = new PointF(0, 0);

diagram1.View.MouseTrackingEnabled = false;

diagram1.Model.DocumentSize = new PageSize(diagram1.Size.Width, diagram1.Size.Height);

diagram1.Width = diagram1.Size.Width;

diagram1.Height = diagram1.Size.Height

diagram1.View.ZoomToActual();

 2 - I want to disable Zoom And Pan operations totally that user of my form will not be able to zoom and pan the page!!!

You can disable the Pan and Zoom tool action by using ToolActivated event. Once Zoom and Pan tool is activated, we have reset the tool to SelectTool.

 

Code snippet:

//Hook ToolActivated event.

((DiagramViewerEventSink)diagram1.EventSink).ToolActivated += Form1_ToolActivated;

//Reset the tool Select once zoom and pan tool is activated.

private void Form1_ToolActivated(ToolEventArgs evtArgs)

{

    if (evtArgs.Tool.Name == "ZoomTool" || evtArgs.Tool.Name == "PanTool")

        diagram1.Controller.ActivateTool("SelectTool");

}

 

 


Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/DiagramFillToWindowModified-2141604918


Regards,

Deepa Thiruppathy


Marked as answer

MO mohammad replied to Deepa Thiruppathy January 2, 2023 06:56 AM UTC

Hi Deepa Im very Thankful
this will do The job 

but I Have another Question !!

Is There Any way That I can Prevent Zooming my page using  (Ctrl+MouseScroll)
I do not want it to zoom in or out by pressing Ctrl button and scroll Mouse !!





DT Deepa Thiruppathy Syncfusion Team January 4, 2023 01:43 PM UTC

Hi Mohammad,


Reported issue: How to prevent zoom when using Ctrl+MouseScroll


We suggest you set ZoomIncrement as 0 to prevent zooming from Ctrl+MouseScroll action.


Code snippet:

this.diagram1.View.ZoomIncrement = 0;


Loader.
Live Chat Icon For mobile
Up arrow icon