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

how to intialize diagram scroll bar position and range

Hi,
V4.4.0.51 and VS.NET 2003

I used following similar code to load a diagram from a table BLOB, then set up the initial scroll bar position to (0,0). But my code does not work. How can I setup the scroll bar to (0,0)- X bar to the most left, Y bar to the most top? and the scroll bar ranges?
Thanks,

Lan

//load tree to diagram from a stream stored in BLOB field
LoadTree();
//initilize view
diagram.View.PageSettings.Landscape=true;
diagram.View.PageSettings.Bounds.Width=600
diagram.View.PageSettings.Bounds.Height=400
this.diagram.Model.Width=600
this.diagram.Model.Height=400
//set view Magnification to 100
this.diagram.View.Magnification = new System.Drawing.Size(100, 100);
// set scroll bar initial position to (0,0)
this.diagram.View.ScrollBy(0,0); // not work
this.diagram.UpdateScrollRange();
this.diagram.UpdateScrollBars();
this.diagram.View.Update();




scroolbar.zip

8 Replies

J. J.Nagarajan Syncfusion Team January 16, 2007 10:48 PM UTC

Hi Lan,

If your intention is to set the scroll bar's initial position to origin then you can use the value property of HScrollBar and VScrollBar. Please refer to the following code snippet

this.diagram1.HScrollBar.Value=0;
this.diagram1.VScrollBar.Value=0;

I hope this will meet your requirement. Please let me know if you have any questions.

Thanks,
Nagaraj


LM Lan Mo January 17, 2007 02:36 PM UTC

Hi,
Yes, the scroll bar position is OK now. How about the view position? The attached ViewPosition.jpg shows the view position is not at (0,0). This diagram is saved into BLOB field when the view position is not at (0,0) by 'Pan Tool" and loaded again from BLOB. I want it to be at (0,0) after loading from BLOB as attached
ViewPosition_OK.jpg. What property I need to set?
Thanks,

Lan

ViewPosition.zip


AD Administrator Syncfusion Team January 17, 2007 02:43 PM UTC

Hi,
I forgot to attach my code for set up position:

//Loading diagram from stream stored in BLOB field
LoadTreeFromDB();

// set scroll bar and diagram view to (0,0)
this.diagram.HScrollBar.Value=0;
this.diagram.VScrollBar.Value=0;
this.diagram.View.Location=new Point(0,0); //this doesn't set view to (0,0)
this.diagram.Update();


Lan


J. J.Nagarajan Syncfusion Team January 17, 2007 05:06 PM UTC

Hi Lan ,

We regret for the inconvenience caused. I have tested this issue in v.4.4.0.51. I am afraid, I was not able to reproduce this issue. I have attached my test sample.

View Position.zip

Could you please check the sample and let me know whether you are able to reproduce the issue in this sample?. It would be helpful if you provide a sample or modify the sample attached to reproduce this issue.It will help us to resolve it as early as possible.

Thanks for using Essential Diagram.

Regards,
J.Nagaraj


AD Administrator Syncfusion Team January 17, 2007 06:37 PM UTC

Hi,
Thank you for help.

I modified your sample by adding "PanTool" in your menu so that you can add some sysmbol nodes then Click menu 'Pan' to drag the diagram view off the (0,0), save it to file. Open the file again to diaplay the diagram. I want the diagram view is at (0,0).

Please see the "a.edp" file saved.




Lan





AD Administrator Syncfusion Team January 19, 2007 03:24 PM UTC

Hi,
I am sorry your sample diagram does not work the way I like.

I've modified your sample by adding "PanTool" in your menu so that you can add some sysmbol nodes then Click menu 'Pan' to drag the diagram view off the (0,0) position, then save it to a file such as "a.edp". Open the file "a.edp" again to diaplay the diagram. You will notice this diagram's view does not display at (0,0).
I want after the diagram has been loaded from a file 'a.edp', set the diagram view position to (0,0) by code.

Thanks,

Lan


View Position.zip


J. J.Nagarajan Syncfusion Team January 19, 2007 07:36 PM UTC

Hi Lan,

Sorry for the delay in getting back to you. I was able to visualize the condition that you have mentioned here. If your intention is to set the view position of the diagram to (0,0) then you have to set the Origin property of View class to (0,0). Please refer to the following code snippet.

this.diagram1.Controller.View.Origin=new Point(0,0);
this.diagram1.HScrollBar.Value=0;
this.diagram1.VScrollBar.Value=0;

I have attached the sample that demonstrates this completely. Please refer to it and let me know if you have any questions.

Thanks,
Nagaraj

View Position.zip



AD Administrator Syncfusion Team January 22, 2007 03:07 PM UTC

Thank you. It works well for me.

Loader.
Live Chat Icon For mobile
Up arrow icon