show frame offset

This commit is contained in:
Chris Forbes
2009-10-28 21:39:59 +13:00
parent 5d1ae1cb2a
commit d1a665148e

View File

@@ -19,6 +19,15 @@ namespace SequenceEditor
Dictionary<string, Dictionary<int, Rectangle>> items
= new Dictionary<string, Dictionary<int, Rectangle>>();
Point mousePos;
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
mousePos = e.Location;
Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
@@ -26,6 +35,23 @@ namespace SequenceEditor
var x = 0;
var y = 0;
Point? toolPoint = null;
string toolText = "";
if (items.Count > 0)
{
foreach (var shp in items)
{
var sel = shp.Value.FirstOrDefault(a => a.Value.Contains(mousePos));
if (!sel.Value.IsEmpty)
{
e.Graphics.FillRectangle(Brushes.Silver, sel.Value);
toolPoint = new Point(sel.Value.Left, sel.Value.Bottom);
toolText = sel.Key.ToString();
}
}
}
items.Clear();
foreach (var shp in Program.Shps)
@@ -78,6 +104,13 @@ namespace SequenceEditor
seqid = ++seqid % brushes.Length;
}
if (toolPoint.HasValue)
{
var size = e.Graphics.MeasureString(toolText, Font);
e.Graphics.FillRectangle(Brushes.Silver, toolPoint.Value.X, toolPoint.Value.Y, size.Width, size.Height);
e.Graphics.DrawString(toolText, Font, Brushes.Black, toolPoint.Value.X, toolPoint.Value.Y);
}
}
}
}