Improve the color dialog more

This commit is contained in:
KillzXGaming 2020-02-15 19:13:41 -05:00
parent 7751ebed52
commit 454268a740
2 changed files with 17 additions and 16 deletions

View file

@ -131,26 +131,29 @@ namespace Toolbox.Library.Forms
if (e.Button == MouseButtons.Left) if (e.Button == MouseButtons.Left)
{ {
mouseLoc = e.Location; if (!dialogActive) {
this.Invalidate(); mouseLoc = e.Location;
this.Invalidate();
}
if (TopLeftHit.IsHit(e.Location)) if (TopLeftHit.IsHit(e.Location))
LoadColorDialog(TopLeftColor, 0); LoadColorDialog(TopLeftColor, 0);
if (TopRightHit.IsHit(e.Location)) else if (TopRightHit.IsHit(e.Location))
LoadColorDialog(TopRightColor, 1); LoadColorDialog(TopRightColor, 1);
if (BottomLeftHit.IsHit(e.Location)) else if (BottomLeftHit.IsHit(e.Location))
LoadColorDialog(BottomLeftColor, 2); LoadColorDialog(BottomLeftColor, 2);
if (BottomRightHit.IsHit(e.Location)) else if (BottomRightHit.IsHit(e.Location))
LoadColorDialog(BottomRightColor, 3); LoadColorDialog(BottomRightColor, 3);
if (TopHit.IsHit(e.Location)) else if (TopHit.IsHit(e.Location))
LoadColorDialogSides(TopRightColor, TopLeftColor, 0); LoadColorDialogSides(TopRightColor, TopLeftColor, 0);
if (BottomHit.IsHit(e.Location)) else if (BottomHit.IsHit(e.Location))
LoadColorDialogSides(BottomRightColor, BottomLeftColor, 1); LoadColorDialogSides(BottomRightColor, BottomLeftColor, 1);
if (RightHit.IsHit(e.Location)) else if (RightHit.IsHit(e.Location))
LoadColorDialogSides(TopRightColor, BottomRightColor, 2); LoadColorDialogSides(TopRightColor, BottomRightColor, 2);
if (LeftHit.IsHit(e.Location)) else if (LeftHit.IsHit(e.Location))
LoadColorDialogSides(TopLeftColor, BottomLeftColor, 3); LoadColorDialogSides(TopLeftColor, BottomLeftColor, 3);
if (AllHit.IsHit(e.Location)) else if (AllHit.IsHit(e.Location))
{ {
if (dialogActive) if (dialogActive)
{ {
@ -164,8 +167,8 @@ namespace Toolbox.Library.Forms
colorDlg.FormClosed += delegate colorDlg.FormClosed += delegate
{ {
mouseLoc = Point.Empty; mouseLoc = Point.Empty;
this.Invalidate();
dialogActive = false; dialogActive = false;
this.Invalidate();
}; };
colorDlg.ColorChanged += delegate colorDlg.ColorChanged += delegate
{ {
@ -182,8 +185,6 @@ namespace Toolbox.Library.Forms
}; };
} }
} }
this.Invalidate();
} }
private void LoadColorDialogSides(Color color1, Color color2, int index) private void LoadColorDialogSides(Color color1, Color color2, int index)
@ -208,8 +209,8 @@ namespace Toolbox.Library.Forms
colorDlg.FormClosed += delegate colorDlg.FormClosed += delegate
{ {
mouseLoc = Point.Empty; mouseLoc = Point.Empty;
this.Invalidate();
dialogActive = false; dialogActive = false;
this.Invalidate();
}; };
colorDlg.Show(); colorDlg.Show();
colorDlg.ColorChanged += delegate colorDlg.ColorChanged += delegate
@ -250,8 +251,8 @@ namespace Toolbox.Library.Forms
colorDlg.FormClosed += delegate colorDlg.FormClosed += delegate
{ {
mouseLoc = Point.Empty; mouseLoc = Point.Empty;
this.Invalidate();
dialogActive = false; dialogActive = false;
this.Invalidate();
}; };
colorDlg.Show(); colorDlg.Show();
colorDlg.ColorChanged += delegate colorDlg.ColorChanged += delegate

View file

@ -29,7 +29,7 @@ namespace Toolbox.Library.Forms
//Wait until the user can lose focus for closing control //Wait until the user can lose focus for closing control
//This prevents window from popping up and closing instantly //This prevents window from popping up and closing instantly
Utils.DelayAction(2000,delegate Utils.DelayAction(100,delegate
{ {
CanCloseOnLostFocus = true; CanCloseOnLostFocus = true;
}); });