initial drag and drop visual (shows there is a bug to figure out)

This commit is contained in:
Tim Young 2017-09-17 17:36:57 -05:00
parent 30a3d1e4b3
commit 1361a46b7c
1 changed files with 25 additions and 0 deletions

View File

@ -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()