show frame offset
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user