This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

LineVObject Issue

ChingYen#14773
Hi,

We tried to do this

float tmpLine = (float)lpX.Value;
Aurigma.GraphicsMill.WinControls.LineVObject lpLine = new Aurigma.GraphicsMill.WinControls.LineVObject(tmpLine, 0, tmpLine, _workingMultilayerViewer.WorkspaceHeight * 72);
lpLine.Pen.Width = 0.1f;
lpLine.Brush = null;
PointF[] test = GetTransformedCornerPoints(lpLine);
               _workingMultilayerViewer.Layers[0].VObjects.Add(lpLine);

        private System.Drawing.PointF[] GetTransformedCornerPoints(Aurigma.GraphicsMill.WinControls.VObject obj)
        {
            System.Drawing.RectangleF baseRect = obj.GetVObjectBounds();
            System.Drawing.PointF[] cornerPnts = new System.Drawing.PointF[4];

            try
            {
                cornerPnts[0] = baseRect.Location;
                cornerPnts[1] = new System.Drawing.PointF(baseRect.Right, baseRect.Top);
                cornerPnts[2] = new System.Drawing.PointF(baseRect.Right, baseRect.Bottom);
                cornerPnts[3] = new System.Drawing.PointF(baseRect.Left, baseRect.Bottom);
                obj.Transform.TransformPoints(cornerPnts);
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
            return cornerPnts;
        }



We found that, when tmpLine = 22.6768
Test Point will be
+ [0] {X = 22.6768 Y = 0.0} System.Drawing.PointF
+ [1] {X = 22.726799 Y = 0.0} System.Drawing.PointF
+ [2] {X = 22.726799 Y = 612.0} System.Drawing.PointF
+ [3] {X = 22.6768 Y = 612.0} System.Drawing.PointF

Wondering why the value for X are not all the same?

We did check on some other numbers like tmpLine=28.346, it gave no issue @ all.

Please advise.

Dmitry.Obukhov#14781
Ching-Yen,

It is not issue. You use GetVObjectBounds() method to get bounds of the line vector object:
 System.Drawing.RectangleF baseRect = obj.GetVObjectBounds();

Therefore, you get a bit different values from right side. The difference is 0.05. I checked tmpLine = 28.346. And got
[1]	{X = 28.396 Y = 0.0}	System.Drawing.PointF
[2]	{X = 28.396 Y = 612.0}	System.Drawing.PointF