Profile Picture

Document resizing and border thikness

Posted By Marius Bucur 15 Years Ago
Author
Message
Marius Bucur
Posted 15 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1
I have a problem with shapes after I change the size of a drawing view, meaning the shapes border become increasingly thicker if the difference between original drawing size is greater. Any idea how to fix that?

Ivo Milanov
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)

Group: Forum Members
Last Active: 2 Months Ago
Posts: 35, Visits: 15
This can only occur if the drawing view is using some sort of Fit or Stretch layout strategy. The view fits, or stretches the document by actually modifying the zoom factor of the view, which is the designed behavior of the view. Can you please elaborate on what is actually the problem.

Best regards,
Ivo

Marius Bucur
Posted 15 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1
The ideea is this:
- create a default document/view with predefined size, let say 300/200;
- load an architectural floor plan for background, this is an image with let say 3600/1500 pixels;
- update the size of the document with document.Bounds = new RectangleF(0, 0, imageWidth, imageHeight);
- create a shape with the width and height of the background image to hold the background image (first layer will be the background, i need it to be able to hide and show the background image);
- update the zoom with view.fit() and document.RefreshAllViews();
- create a calibration rectangle (i use this to measure some known distances on image and make width and height of the rectangle to actually correspond to real values);
- calibrate the rectangle after some know values in image;
- calculate the scaleFactor between calibration rectangle width or height and real width or height value;
- calculate the new width and height like this: float newWidth = document.Width / scaleFactor;
- resize the background image shape to backgroundRect.SetBounds(new NRectangleF(0, 0, newWidth, newHeight));
- resize the document with document.Bounds = new NRectangleF(0, 0, newWidth, newHeight);
- view.Fit() & document.RefreshAllViews();

Now the document is (in my case with the background image i use) at roughly 400% zoom factor after fit. Any new shape i add now will have increased borders.



Ivo Milanov
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)

Group: Forum Members
Last Active: 2 Months Ago
Posts: 35, Visits: 15
Hi Marius,

It is hard to tell what are the document bounds after all the operations that you have mentioned. However a zoom factor of 400% means that its final width or height is approximately 4 times smaller than the view size. If your view had an initial size of 300x200 px, then the document you are fitting was finally only 75x50 px.

Why do you need to resize the document and the background shape that you have created? I think that this operation is unnecessary and simply makes the document and the background too small. Then after the fit your zoom becomes so big because the document is too small and it naturally increases the lines width.

Best regards,
Ivo



Similar Topics


Reading This Topic