Hi Domenico,
Thanks for the update.
The Diagram’s FitDocument method is used to fits the document based on the page size not on the control’s size. Since it fits the document only based on its document size, the gray bounds around the diagram is always visible when the diagram size is changed and this is the current behavior of the control. You can also use the diagram.View’s ‘ScrollVirtualBounds’ property to change the origin of the document when the control resized, which makes diagram looks better. Hence, we suggest you to use the previous solution provided in this forum to achieve your requirement.
Here is the code snippet:
// Gets or sets the bounds of scrollable area. Can be set only positive values.
this.diagram1.View.ScrollVirtualBounds = new RectangleF(0, 0, 0, 0);
We have modified your sample and the same can be downloaded from the below link:
Forum FitDocument-1899076960.zipPlease try the above sample and let us know if you have any queries.
Regards,
Amsath Ali. M