diff --git a/ShareX/Controls/TaskRoundedCornerPanel.cs b/ShareX/Controls/TaskRoundedCornerPanel.cs index 85ba04547..c9d20fed0 100644 --- a/ShareX/Controls/TaskRoundedCornerPanel.cs +++ b/ShareX/Controls/TaskRoundedCornerPanel.cs @@ -32,6 +32,25 @@ namespace ShareX { 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 ThumbnailTitleLocation StatusLocation { get; set; } @@ -66,10 +85,20 @@ protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); + 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) { - Graphics g = e.Graphics; - g.PixelOffsetMode = PixelOffsetMode.Half; int y; diff --git a/ShareX/Controls/TaskThumbnailPanel.Designer.cs b/ShareX/Controls/TaskThumbnailPanel.Designer.cs index 6fc54f3fe..a761644b7 100644 --- a/ShareX/Controls/TaskThumbnailPanel.Designer.cs +++ b/ShareX/Controls/TaskThumbnailPanel.Designer.cs @@ -34,7 +34,6 @@ private void InitializeComponent() this.components = new System.ComponentModel.Container(); this.ttMain = new System.Windows.Forms.ToolTip(this.components); this.pThumbnail = new ShareX.TaskRoundedCornerPanel(); - this.cbSelected = new ShareX.HelpersLib.BlackStyleCheckBox(); this.pbProgress = new ShareX.HelpersLib.BlackStyleProgressBar(); this.pbThumbnail = new System.Windows.Forms.PictureBox(); this.lblTitle = new ShareX.HelpersLib.BlackStyleLabel(); @@ -53,7 +52,6 @@ private void InitializeComponent() // pThumbnail // this.pThumbnail.BackColor = System.Drawing.Color.Transparent; - this.pThumbnail.Controls.Add(this.cbSelected); this.pThumbnail.Controls.Add(this.pbProgress); this.pThumbnail.Controls.Add(this.pbThumbnail); 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.PanelColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(32)))), ((int)(((byte)(38))))); this.pThumbnail.Radius = 5F; + this.pThumbnail.Selected = false; this.pThumbnail.Size = new System.Drawing.Size(256, 256); this.pThumbnail.StatusLocation = ShareX.ThumbnailTitleLocation.Top; this.pThumbnail.TabIndex = 0; 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 // 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 System.Windows.Forms.PictureBox pbThumbnail; private System.Windows.Forms.ToolTip ttMain; - private HelpersLib.BlackStyleCheckBox cbSelected; } } diff --git a/ShareX/Controls/TaskThumbnailPanel.cs b/ShareX/Controls/TaskThumbnailPanel.cs index 09c3a7182..a28d623ea 100644 --- a/ShareX/Controls/TaskThumbnailPanel.cs +++ b/ShareX/Controls/TaskThumbnailPanel.cs @@ -110,7 +110,7 @@ public bool Selected { selected = value; - cbSelected.Visible = selected; + pThumbnail.Selected = selected; } } } diff --git a/ShareX/Forms/QRCodeForm.cs b/ShareX/Forms/QRCodeForm.cs index 4fdcdc362..9bca9b9fc 100644 --- a/ShareX/Forms/QRCodeForm.cs +++ b/ShareX/Forms/QRCodeForm.cs @@ -219,7 +219,9 @@ private void btnDecodeFromScreen_Click(object sender, EventArgs e) Hide(); 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) {