public override bool ClickableAt(int x, int y)
{
Rectangle rect = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);
int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS) + 10;
Color fillColor = GetFieldValueAsColor(FieldType.FILL_COLOR);
// If we clicked inside the rectangle and it's visible we are clickable at.
if (!Color.Transparent.Equals(fillColor))
{
if (Contains(x, y))
{
return true;
}
}
// check the rest of the lines
if (lineThickness > 0)
{
using (Pen pen = new Pen(Color.White, lineThickness))
{
using (GraphicsPath path = new GraphicsPath())
{
path.AddEllipse(rect);
return path.IsOutlineVisible(x, y, pen);
}
}
}
else
{
return false;
}
}