diff --git a/SpriteLibrary/SpriteEntryForm.cs b/SpriteLibrary/SpriteEntryForm.cs index 6c49cfc..353e7ec 100644 --- a/SpriteLibrary/SpriteEntryForm.cs +++ b/SpriteLibrary/SpriteEntryForm.cs @@ -12,6 +12,7 @@ using System.IO; using System.Resources; using System.Windows.Forms; using System.Collections; +using System.Drawing.Drawing2D; namespace SpriteLibrary @@ -120,6 +121,30 @@ namespace SpriteLibrary private void UpdateChosenAreaLabel() { lblChosenArea.Text = ChosenArea.X + "," + ChosenArea.Y + "," + ChosenArea.Width + "," + ChosenArea.Height; + UpdateHighlightBox(); + } + + private void UpdateHighlightBox() + { + int transparency = 200; + Image NewFrontImage = new Bitmap(pbImageField.BackgroundImage.Width, pbImageField.BackgroundImage.Height); + Color FillColor = Color.Green; + Brush brush = new SolidBrush(Color.FromArgb(transparency, FillColor.R, FillColor.G, FillColor.B)); + Brush nobrush = new SolidBrush(Color.FromArgb(0,0,0,0)); + using (Graphics G = Graphics.FromImage(NewFrontImage)) + { + G.FillRectangle(brush, 0,0,NewFrontImage.Width,NewFrontImage.Height); + GraphicsPath path = new GraphicsPath(); + path.AddRectangle(ChosenArea); + G.SetClip(path); + G.Clear(Color.Transparent); + G.ResetClip(); + // G.FillRectangle(nobrush, ChosenArea); + + } + pbImageField.Image = NewFrontImage; + pbImageField.SizeMode = PictureBoxSizeMode.StretchImage; + pbImageField.Invalidate(); } private void SetUpEmptyInfo()