MultipleSelect on rotate image

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
User avatar
Paolo Turrini
Posts: 4
Joined: 25 Feb 2011, 12:06

MultipleSelect on rotate image

Post by Paolo Turrini » 13 May 2011, 19:22

I have a dxf image that it is was rotate with:

Code: Select all

this.cadImage.Rotate(Axes.Z, 90);
when i use:

Code: Select all

private bool MultipleSelect()
        {
            if (cadImage.SelectionMode == SelectionEntityMode.Enabled)
            {
                int l = this.clipRectangle.ClientRectangle.Left;
                int t = this.clipRectangle.ClientRectangle.Top;
                DPoint pt1 = this.GetRealPoint(l, t);
                DPoint pt2 = this.GetRealPoint(this.clipRectangle.ClientRectangle.Right, this.clipRectangle.ClientRectangle.Bottom);
                DRect tmpRect = new DRect(pt1.X, pt1.Y, pt2.X, pt2.Y);
                Region rg = cadImage.GetSelectEntityRegion(new Rectangle((int)l, (int)t, this.clipRectangle.ClientRectangle.Width, this.clipRectangle.ClientRectangle.Height));
                try
                {
                    cadImage.MultipleSelect(tmpRect, true, true);
                }
                catch { }
                cadPictBox.Invalidate(rg);
                rg.Dispose();
                return true;
            }
            return false;
        }
No entities are selected.

Do you know how solve this problem?
Paolo Turrini

Consulenze Informatiche
Via Pavone 71
44121 Ferrara - Italy

Tel. +39 051 051 64 90
Fax. +39 0532 19 11 789
Cel.+39 339 8715400

E-mail: info@informaticaturrini.com
Sito: http://www.informaticaturrini.com

support
Posts: 3256
Joined: 30 Mar 2005, 11:36
Contact:

Re: MultipleSelect on rotate image

Post by support » 16 May 2011, 14:47

Hello Paolo.
The problem depends on the following code:

Code: Select all

DRect tmpRect = new DRect(pt1.X, pt1.Y, pt2.X, pt2.Y);
MultipleSelect method requires DRect object that meet the conditions: top > bottom and right > left. The rectangle from the rotated image can mismatch the conditions. You can substitute the following code instead the above mentioned:

Code: Select all

DRect tmpRect = DRect.BadRect;
tmpRect.Expand(pt1);
tmpRect.Expand(pt2);
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply