Scrollbars appear after RescaleToFit

On some of our diagrams we see the vertical and horizontal scrollbars
after the call to RescaleToFit. Sometimes the slider covers 100%
of the space and sometimes most of the space. In the latter, if
we then click on the empty portion of the scrollbar, both the vertical
and horizontal would disappear. This is a desired result.
Is there a way to automate it so that after the RescaleToFit that there
would be no scrollbars.

We saw reference to RescaleToFit - “Calling this method will not
necessarily cause the scroll bars to disappear, because the scroll bars
normally show the extent of the document, which is normally greater
than the extent of the actual objects in the document.” but don’t
know enough to code around it.

In general, if the document is larger than the rectangular area occupied by objects in the document, the scroll bars will remain. You would need to set the GoDocument.TopLeft and .Size properties to shrink the size of the document, so that all of it could appear in the GoView without scroll bars.
However, in your case that probably isn’t the problem, since you say that scrolling slightly causes the scroll bars to go away after all. Since clicking on the scroll bar changes the GoView.DocPosition, it seems that GoView.RescaleToFit isn’t setting GoView.DocPosition quite right for your application.
GoView.RescaleToFit calls GoView.ComputeDocumentBounds(), which iterates over all of the objects in the document and returns the union of all their Bounds.
The GoView.UpdateScrollBars method computes the scroll bars’ position and visibility for a GoView by depending on the GoView.DocumentSize and GoView.DocumentTopLeft properties.
I suspect that the bounds returned by GoView.DocumentSize and GoView.DocumentTopLeft are slightly larger to the top and/or to the left, which causes the view to think that the current GoView.DocPosition value requires the use of the scrollbars. We’ll need to investigate this; I didn’t encounter the problem with the sample applications such as Demo1.
You could try working around this by calling GoView.ScrollLine(-1, -1) to see if that helps or not.
If you could describe what objects you have in your document and where they are located, that might be useful for us to figure out what’s going on.

That behavior occasionally happens due to a round-off error. Fixed in next release.

is this “next release” available?

The 2.5 beta test version is available: http://www.nwoods.com/forum/forum_posts.asp?TID=1412
That was the first public beta kit, and I think also the last one for Windows Forms before the official release (as yet unscheduled), since there haven’t been many bugs.

thanks Walter. I’m using now this beta version.
It fixes some of my problems.
This is one case when things are better: INITIALLY if I repeatedly called RescaleToFit() (ex. clicking a button) once I was getting scrollbars, once everything was ok. (first click->no scroll, 2nd click -> scrollbars, 3rd click -> no scroll, 4th click scrollbars , and so on…).This is what always happened to my view. NOW after the first call of RescaleToFit() the view looks fine. After the second call , the objects are moved a little, looks like are better arranged in the view, and I still have no scrollbars, and next calls of RescaleToFit() doesn’t bring any changes on the view. This is good.
But now, if you move one object on the edge of the view, and scrollbars are shown, calling RescaleToFit sometimes seems to have no result. Now, sometimes, when the view is zoomed to fit but you have scrollbars , and you try to scroll using the scrollbar, after you drag the scrollbar, it disappears!!
Any ideas on how to avoid this behavior?

We’ll investigate.

I’m not sure I am exactly reproducing the conditions that you were experiencing, but I think it is working correctly. I am guessing that you were moving an object at the bottom or the right edge of the view, thereby extending the size of the GoDocument.
Did you read the documentation for GoView.RescaleToFit? If you always want to try to remove the scrollbars, you probably want to reduce the size of the document so that the scroll bars aren’t needed. From the API documentation:

Remarks

This calls ComputeDocumentBounds to determine the size and position of this view's document. If the document is very large, the LimitDocScale method might prevent the whole document from fitting. LimitDocPosition may similarly prevent the whole document from fitting. Calling this method will not necessarily cause the scroll bars to disappear, because the scroll bars normally show the extent of the document, which is normally greater than the extent of the actual objects in the document. This method does not modify the size and position of the view's document. Depending on your application, you may wish to shrink the size of the document in order to cause the scroll bars to disappear.
  RectangleF docb = goView1.ComputeDocumentBounds();
  goView1.Document.TopLeft = docb.Location;
  goView1.Document.Size = docb.Size;
  goView1.RescaleToFit();

It behaves perfectly using this code !