automatically focus drawing area when mouse is clicked and draw the focus rectangle (should this be in UWT Control - FocusOnClick?)

This commit is contained in:
Michael Becker 2021-02-20 22:21:17 -05:00
parent 686a47e426
commit 1a23b52ce9
No known key found for this signature in database
GPG Key ID: 98C333A81F18C22C

View File

@ -22,6 +22,7 @@
using System;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Drawing;
using MBS.Framework.UserInterface.Input.Mouse;
using UniversalEditor.ObjectModels.Multimedia.Picture;
@ -44,6 +45,14 @@ namespace UniversalEditor.Controls.DrawingArea
this.Refresh();
}
}
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
Focus();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
@ -59,6 +68,11 @@ namespace UniversalEditor.Controls.DrawingArea
Image image = mvarPicture.ToImage();
e.Graphics.DrawImage(image, 0, 0);
}
if (Focused)
{
e.Graphics.DrawFocus(0, 0, Size.Width, Size.Height);
}
}
}
}