mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-03 02:36:50 +13:00
Improve panel selected visual
This commit is contained in:
parent
f438161c0c
commit
616a200baa
4 changed files with 36 additions and 20 deletions
|
@ -32,6 +32,25 @@ namespace ShareX
|
||||||
{
|
{
|
||||||
public class TaskRoundedCornerPanel : RoundedCornerPanel
|
public class TaskRoundedCornerPanel : RoundedCornerPanel
|
||||||
{
|
{
|
||||||
|
private bool selected;
|
||||||
|
|
||||||
|
public bool Selected
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (selected != value)
|
||||||
|
{
|
||||||
|
selected = value;
|
||||||
|
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Color StatusColor { get; private set; } = Color.Transparent;
|
public Color StatusColor { get; private set; } = Color.Transparent;
|
||||||
public ThumbnailTitleLocation StatusLocation { get; set; }
|
public ThumbnailTitleLocation StatusLocation { get; set; }
|
||||||
|
|
||||||
|
@ -66,10 +85,20 @@ protected override void OnPaint(PaintEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnPaint(e);
|
base.OnPaint(e);
|
||||||
|
|
||||||
if (StatusColor.A > 0)
|
|
||||||
{
|
|
||||||
Graphics g = e.Graphics;
|
Graphics g = e.Graphics;
|
||||||
|
|
||||||
|
if (Selected)
|
||||||
|
{
|
||||||
|
g.PixelOffsetMode = PixelOffsetMode.Default;
|
||||||
|
|
||||||
|
using (Pen pen = new Pen(ShareXResources.Theme.TextColor) { DashStyle = DashStyle.Dot })
|
||||||
|
{
|
||||||
|
g.DrawRoundedRectangle(pen, ClientRectangle, Radius);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StatusColor.A > 0)
|
||||||
|
{
|
||||||
g.PixelOffsetMode = PixelOffsetMode.Half;
|
g.PixelOffsetMode = PixelOffsetMode.Half;
|
||||||
|
|
||||||
int y;
|
int y;
|
||||||
|
|
17
ShareX/Controls/TaskThumbnailPanel.Designer.cs
generated
17
ShareX/Controls/TaskThumbnailPanel.Designer.cs
generated
|
@ -34,7 +34,6 @@ private void InitializeComponent()
|
||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
this.ttMain = new System.Windows.Forms.ToolTip(this.components);
|
this.ttMain = new System.Windows.Forms.ToolTip(this.components);
|
||||||
this.pThumbnail = new ShareX.TaskRoundedCornerPanel();
|
this.pThumbnail = new ShareX.TaskRoundedCornerPanel();
|
||||||
this.cbSelected = new ShareX.HelpersLib.BlackStyleCheckBox();
|
|
||||||
this.pbProgress = new ShareX.HelpersLib.BlackStyleProgressBar();
|
this.pbProgress = new ShareX.HelpersLib.BlackStyleProgressBar();
|
||||||
this.pbThumbnail = new System.Windows.Forms.PictureBox();
|
this.pbThumbnail = new System.Windows.Forms.PictureBox();
|
||||||
this.lblTitle = new ShareX.HelpersLib.BlackStyleLabel();
|
this.lblTitle = new ShareX.HelpersLib.BlackStyleLabel();
|
||||||
|
@ -53,7 +52,6 @@ private void InitializeComponent()
|
||||||
// pThumbnail
|
// pThumbnail
|
||||||
//
|
//
|
||||||
this.pThumbnail.BackColor = System.Drawing.Color.Transparent;
|
this.pThumbnail.BackColor = System.Drawing.Color.Transparent;
|
||||||
this.pThumbnail.Controls.Add(this.cbSelected);
|
|
||||||
this.pThumbnail.Controls.Add(this.pbProgress);
|
this.pThumbnail.Controls.Add(this.pbProgress);
|
||||||
this.pThumbnail.Controls.Add(this.pbThumbnail);
|
this.pThumbnail.Controls.Add(this.pbThumbnail);
|
||||||
this.pThumbnail.Location = new System.Drawing.Point(0, 24);
|
this.pThumbnail.Location = new System.Drawing.Point(0, 24);
|
||||||
|
@ -61,24 +59,12 @@ private void InitializeComponent()
|
||||||
this.pThumbnail.Padding = new System.Windows.Forms.Padding(5);
|
this.pThumbnail.Padding = new System.Windows.Forms.Padding(5);
|
||||||
this.pThumbnail.PanelColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(32)))), ((int)(((byte)(38)))));
|
this.pThumbnail.PanelColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(32)))), ((int)(((byte)(38)))));
|
||||||
this.pThumbnail.Radius = 5F;
|
this.pThumbnail.Radius = 5F;
|
||||||
|
this.pThumbnail.Selected = false;
|
||||||
this.pThumbnail.Size = new System.Drawing.Size(256, 256);
|
this.pThumbnail.Size = new System.Drawing.Size(256, 256);
|
||||||
this.pThumbnail.StatusLocation = ShareX.ThumbnailTitleLocation.Top;
|
this.pThumbnail.StatusLocation = ShareX.ThumbnailTitleLocation.Top;
|
||||||
this.pThumbnail.TabIndex = 0;
|
this.pThumbnail.TabIndex = 0;
|
||||||
this.pThumbnail.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PbThumbnail_MouseClick);
|
this.pThumbnail.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PbThumbnail_MouseClick);
|
||||||
//
|
//
|
||||||
// cbSelected
|
|
||||||
//
|
|
||||||
this.cbSelected.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.cbSelected.Checked = true;
|
|
||||||
this.cbSelected.Font = new System.Drawing.Font("Arial", 8F);
|
|
||||||
this.cbSelected.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.cbSelected.IgnoreClick = true;
|
|
||||||
this.cbSelected.Location = new System.Drawing.Point(4, 4);
|
|
||||||
this.cbSelected.Name = "cbSelected";
|
|
||||||
this.cbSelected.Size = new System.Drawing.Size(13, 13);
|
|
||||||
this.cbSelected.TabIndex = 2;
|
|
||||||
this.cbSelected.Visible = false;
|
|
||||||
//
|
|
||||||
// pbProgress
|
// pbProgress
|
||||||
//
|
//
|
||||||
this.pbProgress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
this.pbProgress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
@ -144,6 +130,5 @@ private void InitializeComponent()
|
||||||
private HelpersLib.BlackStyleProgressBar pbProgress;
|
private HelpersLib.BlackStyleProgressBar pbProgress;
|
||||||
private System.Windows.Forms.PictureBox pbThumbnail;
|
private System.Windows.Forms.PictureBox pbThumbnail;
|
||||||
private System.Windows.Forms.ToolTip ttMain;
|
private System.Windows.Forms.ToolTip ttMain;
|
||||||
private HelpersLib.BlackStyleCheckBox cbSelected;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ public bool Selected
|
||||||
{
|
{
|
||||||
selected = value;
|
selected = value;
|
||||||
|
|
||||||
cbSelected.Visible = selected;
|
pThumbnail.Selected = selected;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,7 +219,9 @@ private void btnDecodeFromScreen_Click(object sender, EventArgs e)
|
||||||
Hide();
|
Hide();
|
||||||
Thread.Sleep(250);
|
Thread.Sleep(250);
|
||||||
|
|
||||||
using (Image img = RegionCaptureTasks.GetRegionImage(TaskSettings.GetDefaultTaskSettings().CaptureSettings.SurfaceOptions))
|
TaskSettings taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||||
|
|
||||||
|
using (Image img = RegionCaptureTasks.GetRegionImage(taskSettings.CaptureSettings.SurfaceOptions))
|
||||||
{
|
{
|
||||||
if (img != null)
|
if (img != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue