Overlay visual improvements

This commit is contained in:
Jaex 2022-09-30 07:00:36 +03:00
parent 2e87952175
commit 1677260946
3 changed files with 24 additions and 30 deletions

View file

@ -65,6 +65,7 @@ private void InitializeComponent()
//
// pThumbnail
//
this.pThumbnail.AllowDrop = true;
this.pThumbnail.BackColor = System.Drawing.Color.Transparent;
this.pThumbnail.Controls.Add(this.lblCombineVertical);
this.pThumbnail.Controls.Add(this.lblError);
@ -77,6 +78,9 @@ private void InitializeComponent()
this.pThumbnail.Radius = 5F;
this.pThumbnail.Selected = false;
this.pThumbnail.StatusLocation = ShareX.ThumbnailTitleLocation.Top;
this.pThumbnail.DragDrop += new System.Windows.Forms.DragEventHandler(this.pThumbnail_DragDrop);
this.pThumbnail.DragEnter += new System.Windows.Forms.DragEventHandler(this.pThumbnail_DragEnter);
this.pThumbnail.DragLeave += new System.EventHandler(this.pThumbnail_DragLeave);
//
// lblCombineVertical
//
@ -129,16 +133,12 @@ private void InitializeComponent()
//
// TaskThumbnailPanel
//
this.AllowDrop = true;
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Transparent;
this.Controls.Add(this.pThumbnail);
this.Controls.Add(this.lblTitle);
this.Name = "TaskThumbnailPanel";
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.TaskThumbnailPanel_DragDrop);
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.TaskThumbnailPanel_DragEnter);
this.DragLeave += new System.EventHandler(this.TaskThumbnailPanel_DragLeave);
this.pThumbnail.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pbThumbnail)).EndInit();
this.ResumeLayout(false);

View file

@ -233,7 +233,6 @@ public Size ThumbnailSize
public ThumbnailViewClickAction ClickAction { get; set; }
private Rectangle dragBoxFromMouseDown;
private Orientation combineOrientation;
public TaskThumbnailPanel(WorkerTask task)
{
@ -322,10 +321,10 @@ private void UpdateLayout()
lblError.Location = new Point((ClientSize.Width - lblError.Width) / 2, pThumbnail.Height - lblError.Height - 1);
}
lblCombineHorizontal.Location = new Point(0, 0);
lblCombineHorizontal.Size = new Size(pThumbnail.Width, pThumbnail.Height / 2);
lblCombineVertical.Location = new Point(0, pThumbnail.Height / 2 - 1);
lblCombineVertical.Size = new Size(pThumbnail.Width, pThumbnail.Height / 2);
lblCombineHorizontal.Location = new Point(pbThumbnail.Left, pbThumbnail.Top);
lblCombineHorizontal.Size = new Size(pbThumbnail.Width, pbThumbnail.Height / 2);
lblCombineVertical.Location = new Point(pbThumbnail.Left, pbThumbnail.Top + pbThumbnail.Height / 2 - 1);
lblCombineVertical.Size = new Size(pbThumbnail.Width, pbThumbnail.Height / 2 + 1);
}
public void UpdateThumbnail(Bitmap bmp = null)
@ -570,7 +569,7 @@ private void PbThumbnail_MouseMove(object sender, MouseEventArgs e)
{
if (Task.Info != null && !string.IsNullOrEmpty(Task.Info.FilePath) && File.Exists(Task.Info.FilePath))
{
AllowDrop = false;
pThumbnail.AllowDrop = false;
Program.MainForm.AllowDrop = false;
try
@ -581,7 +580,7 @@ private void PbThumbnail_MouseMove(object sender, MouseEventArgs e)
}
finally
{
AllowDrop = true;
pThumbnail.AllowDrop = true;
Program.MainForm.AllowDrop = true;
}
}
@ -592,7 +591,7 @@ private void PbThumbnail_MouseMove(object sender, MouseEventArgs e)
}
}
private void TaskThumbnailPanel_DragEnter(object sender, DragEventArgs e)
private void pThumbnail_DragEnter(object sender, DragEventArgs e)
{
string filePath = Task.Info.FilePath;
@ -610,28 +609,21 @@ private void TaskThumbnailPanel_DragEnter(object sender, DragEventArgs e)
}
}
private void TaskThumbnailPanel_DragLeave(object sender, EventArgs e)
private void pThumbnail_DragLeave(object sender, EventArgs e)
{
lblCombineHorizontal.Visible = false;
lblCombineVertical.Visible = false;
}
private void TaskThumbnailPanel_DragDrop(object sender, DragEventArgs e)
private void pThumbnail_DragDrop(object sender, DragEventArgs e)
{
Rectangle horizontal = lblCombineHorizontal.RectangleToScreen(lblCombineHorizontal.ClientRectangle);
Orientation combineOrientation = Orientation.Horizontal;
if (horizontal.Contains(e.X, e.Y))
{
combineOrientation = Orientation.Horizontal;
}
else
{
Rectangle vertical = lblCombineVertical.RectangleToScreen(lblCombineVertical.ClientRectangle);
Point vertical = lblCombineVertical.PointToScreen(lblCombineVertical.ClientRectangle.Location);
if (vertical.Contains(e.X, e.Y))
{
combineOrientation = Orientation.Vertical;
}
if (e.Y >= vertical.Y)
{
combineOrientation = Orientation.Vertical;
}
string filePath = Task.Info.FilePath;

View file

@ -147,7 +147,7 @@
<value>1</value>
</data>
<data name="lblCombineVertical.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 20.25pt</value>
<value>Segoe UI, 14.25pt</value>
</data>
<data name="lblCombineVertical.Location" type="System.Drawing.Point, System.Drawing">
<value>40, 128</value>
@ -159,7 +159,8 @@
<value>6</value>
</data>
<data name="lblCombineVertical.Text" xml:space="preserve">
<value>Vertical</value>
<value>Combine images
(Vertical)</value>
</data>
<data name="lblCombineVertical.Visible" type="System.Boolean, mscorlib">
<value>False</value>
@ -211,7 +212,7 @@
<value>1</value>
</data>
<data name="lblCombineHorizontal.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 20.25pt</value>
<value>Segoe UI, 14.25pt</value>
</data>
<data name="lblCombineHorizontal.Location" type="System.Drawing.Point, System.Drawing">
<value>40, 40</value>
@ -223,7 +224,8 @@
<value>5</value>
</data>
<data name="lblCombineHorizontal.Text" xml:space="preserve">
<value>Horizontal</value>
<value>Combine images
(Horizontal)</value>
</data>
<data name="lblCombineHorizontal.Visible" type="System.Boolean, mscorlib">
<value>False</value>