I learnt from someone yesterday about graphic paths and a rectangle edge and how I could set a inner excluded rectangle.
But now I want to invalidate just a diagonal line:
using (Graphics g = Graphics.FromHwnd(this.Handle))
{
if (_RubberLineLastStart.HasValue && _RubberLineLastEnd.HasValue)
{
using (GraphicsPath gp = new GraphicsPath())
{
Rectangle rt = GetSelectionRectangle(_RubberLineLastStart, _RubberLineLastEnd);
gp.AddRectangle(rt);
Region reg = new Region(gp);
Invalidate(reg, false);
Update();
}
}
}
At the moment I am converting the two points into a rectangle and just invalidating that. But can this be better?