/// <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()); } }
/// <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()); }