protected override void OnMouseMove(MouseEventArgs e)
{
if (DesignMode)
return;
if (!HotTrack)
return;
hoverIndex = getTabIndexAtPoint(e.Location);
Rectangle rect = Rectangle.Empty;
if (hoverIndex > -1)
rect = GetTabRect(hoverIndex);
if (rect != Rectangle.Empty)
Invalidate(rect);
else
Refresh();
base.OnMouseMove(e);
}
绘制小三角非常简单,只要在脑子里过一遍等腰三角形的底、高计算方法即可。
C# code
int len = 10;
PointF a = new PointF(rect.X + (float)(rect.Width - len) / 2.0f, rect.Bottom);
PointF b = new PointF(a.X + len, a.Y);
PointF c = new PointF(a.X + len / 2.0f, a.Y - (float)Math.Sqrt(3) * (len / 2.0f) / 2.0f);
PointF[] points = new PointF[] { a, b, c };
g.FillPolygon(
Brushes.White,
points
);