示例#1
0
 /// <summary>
 /// 绘制该控制点
 /// </summary>
 /// <param name="g"></param>
 public void Draw(Graphics g)
 {
     DrawBorderHandler(g, PositionRect, backColor);
     if (selected)
     {
         //选中时边框变粗
         CustomRectangle rect = new CustomRectangle(x - 4, y - 4, 8, 8);
         g.DrawRectangle(new Pen(Color.Black), rect.ToRectangle());
     }
 }
示例#2
0
        public static CustomRectangle ToCustomRectangle(RectangleF re)
        {
            CustomRectangle cus = new CustomRectangle();

            cus.X      = re.X;
            cus.Y      = re.Y;
            cus.Width  = re.Width;
            cus.Height = re.Height;
            return(cus);
        }
示例#3
0
        /// <summary>
        /// 鼠标点击测试,看是否在点附近点击
        /// </summary>
        /// <param name="pt"></param>
        /// <returns></returns>
        public bool MouseHitTest(PointF pt)
        {
            CustomRectangle rect = new CustomRectangle(x - 5, y - 5, 10, 10);   //判断选中时加点误差,使选中更加顺利

            return(rect.IsPointFInRectangle(pt.X, pt.Y));
        }
示例#4
0
 /// <summary>
 /// 绘制边框句柄
 /// </summary>
 /// <param name="g"></param>
 /// <param name="rect"></param>
 private void DrawBorderHandler(Graphics g, CustomRectangle rect, Color clr)
 {
     g.FillRectangle(new SolidBrush(clr), rect.ToRectangleF());
     g.DrawRectangle(new Pen(Color.Black), rect.ToRectangle());
 }