protected void StandardHitTest(Graphics g, OlvListViewHitTestInfo hti, Rectangle bounds, int x, int y)
{
Rectangle r = bounds;
r = ApplyCellPadding(r);
// Did they hit a check box?
Rectangle r2 = this.CalculateCheckBoxBounds(g, r);
Rectangle r3 = r2;
r3.Inflate(2, 2); // slightly larger hit area
if (r3.Contains(x, y)) {
hti.HitTestLocation = HitTestLocation.CheckBox;
return;
}
int width = r2.Width;
// Did they hit the image? If they hit the image of a
// non-primary column that has a checkbox, it counts as a
// checkbox hit
r.X += width;
r.Width -= width;
width = this.CalculateImageWidth(g, this.GetImageSelector());
r2 = r;
r2.Width = width;
if (r2.Contains(x, y)) {
if (this.Column != null && (this.Column.Index > 0 && this.Column.CheckBoxes))
hti.HitTestLocation = HitTestLocation.CheckBox;
else
hti.HitTestLocation = HitTestLocation.Image;
return;
}
// Did they hit the text?
r.X += width;
r.Width -= width;
width = this.CalculateTextWidth(g, this.GetText());
r2 = r;
r2.Width = width;
if (r2.Contains(x, y)) {
hti.HitTestLocation = HitTestLocation.Text;
return;
}
hti.HitTestLocation = HitTestLocation.InCell;
}