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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Centering Diagram in View?

Thread ID:

Created:

Updated:

Platform:

Replies:

22239 Dec 7,2004 06:00 PM UTC Dec 28,2004 02:00 PM UTC WinForms 5
loading
Tags: Diagram
Jeff Fansler
Asked On December 7, 2004 06:00 PM UTC

Is it possible to center the diagram in the view? By default the view is always in the upper left corner. So if you zoom and the entire page fits within the control, the page will be in the upper left with margins on the right and bottom. I''d like to center the page so that there are margins on each side. Any ideas on how to do this?

Administrator [Syncfusion]
Replied On December 9, 2004 05:40 PM UTC

Hi Jeff, As per my earlier update to your posting: From your posting, it is not clear as to what you are trying to do. When the size of the Diagram (i.e. Model) is bigger than the page size, the View shows where each page boundary is. The origin of the View only controls which part of the model is rendered in the View. The origin is specified in logical (i.e. Model) units and it defines the logical point that is mapped to the upper-left hand corner of the View. Here is a < arel='nofollow' href = "http://64.78.18.34/support/user/Uploads/f22239.zip">screenshot where the model size is 200 X 200 pixels. Now if you change the View''s Origin in the Form_Load to say: this.diagram1.View.Origin = new PointF(this.diagram1.Model.Width/2, this.diagram1.Model.Height/2); and then try running the sample. As you can see the origin of the View only controls which part of the Model is rendered in the View so I am not sure what you are seeking to do what you say you want to center the Diagram in the View. With this information, can you post information on what you want to do so that we can ensure that you are all set. Regards Arun

Jeff Fansler
Replied On December 14, 2004 12:30 PM UTC

I apologize if I posted twice, and I''m sorry I wasn''t clearer in my description. I''m still learning this tool. So far I''m very impressed. I think I was using the wrong terms in my original post. What I really want to do is take the diagram and center it within the control bounds. Obviously, if the diagram is zoomed to a point where it is bigger than the control, then I wouldn''t center it anymore. I used the pan tool to move the diagram to the center of the control to give the effect that I am looking for. What I''ve found is that when you pan the diagram to the center, and then use the scroll bars, the diagram jumps back to the default upper left. I have a screen shot, but the attach file page seems to have an issue. If you''d like me to email it, let me know. Also, please feel free to contact me if I''m still not being clear. Thanks for your help, -Jeff Fansler >Hi Jeff, > >As per my earlier update to your posting: > >From your posting, it is not clear as to what you are trying to do. When the size of the Diagram (i.e. Model) is bigger than the page size, the View shows where each page boundary is. The origin of the View only controls which part of the model is rendered in the View. The origin is specified in logical (i.e. Model) units and it defines the logical point that is mapped to the upper-left hand corner of the View. > >Here is a < arel='nofollow' href = "http://64.78.18.34/support/user/Uploads/f22239.zip">screenshot where the model size is 200 X 200 pixels. Now if you change the View''s Origin in the Form_Load to say: > >this.diagram1.View.Origin = new PointF(this.diagram1.Model.Width/2, this.diagram1.Model.Height/2); > >and then try running the sample. > >As you can see the origin of the View only controls which part of the Model is rendered in the View so I am not sure what you are seeking to do what you say you want to center the Diagram in the View. > >With this information, can you post information on what you want to do so that we can ensure that you are all set. > >Regards >Arun

Jeff Fansler
Replied On December 14, 2004 12:34 PM UTC

To get an idea of what I''m talking about... If you happen to have MS Publisher and you load a default blank document, the document will start out zoomed at around 50% and will be centered within the design area. This is what I am trying to accomplish.

Administrator [Syncfusion]
Replied On December 15, 2004 07:38 PM UTC

Hi Jeff Here is a modified version of the QuickStart sample that ships with Essential Diagram that demonstrates what you are seeking to do. You need to set the Origin property of the View. Take a look at the SetViewOrigin() method, which is also called when the Diagram is resized. This could be bundled into a method inside the View and called after the magnification changes and maybe it would be a good idea to include this as a feature of the library and I am following up with the Diagram team on this. Regards Arun

Jeff Fansler
Replied On December 28, 2004 02:00 PM UTC

Hi Arun, Thanks for your help. This points me in the right direction. There are still a couple of problems though. 1) Try taking your sample and turn on the scroll bars. As soon as you scroll in either direction, the origin is set back to the upper left. 2) When you zoom, the origin should also be adjusted so that the page is always centered. I''m going to work on these two problems and if I figure out a solution I will post them here. If you have any ideas on how to fix these problems please share them. Thanks!

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;