Beispiel #1
0
        /// <summary>
        /// 得到矩形的边界线
        /// </summary>
        /// <param name="pt1"></param>
        /// <param name="pt2"></param>
        /// <returns></returns>
        public static PartitionLine[] GetRectBorderLines(Point pt1, Point pt2)
        {
            PartitionLine[] borderLines = new PartitionLine[4];
            Rectangle       rect        = CommonFuns.PointToRectangle(pt1, pt2);

            borderLines[0] = new PartitionLine(rect.X, rect.X + rect.Width, rect.Y, true);
            borderLines[1] = new PartitionLine(rect.X, rect.X + rect.Width, rect.Y + rect.Height, true);
            borderLines[2] = new PartitionLine(rect.Y, rect.Y + rect.Height, rect.X, false);
            borderLines[3] = new PartitionLine(rect.Y, rect.Y + rect.Height, rect.X + rect.Width, false);
            return(borderLines);
        }
Beispiel #2
0
        public static void Invalidate(Control ctl, int pixel, Point pt1, Point pt2, float zoom)
        {
            Rectangle rect = CommonFuns.PointToRectangle(pt1, pt2);

            if (rect.Width == 0)
            {
                rect.Width = 1;
            }
            if (rect.Height == 0)
            {
                rect.Height = 1;
            }
            CommonFuns.Invalidate(ctl, pixel, rect, zoom);
        }
Beispiel #3
0
        /// <summary>
        /// 使包含两点的局部矩形重绘
        /// </summary>
        /// <param name="ctl"></param>
        /// <param name="pixel"></param>
        /// <param name="pt1"></param>
        /// <param name="pt2"></param>
        public static void Invalidate(Control ctl, int pixel, Point pt1, Point pt2)
        {
            Rectangle rect = CommonFuns.PointToRectangle(pt1, pt2);

            if (rect.Width == 0)
            {
                rect.Width = 1;
            }
            if (rect.Height == 0)
            {
                rect.Height = 1;
            }
            ctl.Invalidate(new Rectangle(rect.X - pixel, rect.Y - pixel, rect.Width + 4 * pixel, rect.Height + 4 * pixel));
        }