Page 1 of 1

MultipleSelect on rotate image

Posted: 13 May 2011, 19:22
by Paolo Turrini
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?

Re: MultipleSelect on rotate image

Posted: 16 May 2011, 14:47
by support
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.