Ignore click on checkbox

This commit is contained in:
Jaex 2019-10-02 10:07:18 +03:00
parent a62cc8c700
commit a2f9e06871
2 changed files with 37 additions and 30 deletions

View file

@ -76,8 +76,12 @@ public override string Text
}
}
[DefaultValue(3)]
public int SpaceAfterCheckBox { get; set; }
[DefaultValue(false)]
public bool IgnoreClick { get; set; }
private bool isChecked, isHover;
private string text;
@ -151,7 +155,10 @@ protected override void OnClick(EventArgs e)
{
base.OnClick(e);
Checked = !Checked;
if (!IgnoreClick)
{
Checked = !Checked;
}
}
protected virtual void OnCheckedChanged(EventArgs e)

View file

@ -32,30 +32,16 @@ protected override void Dispose(bool disposing)
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.lblTitle = new ShareX.HelpersLib.BlackStyleLabel();
this.ttMain = new System.Windows.Forms.ToolTip(this.components);
this.cbSelected = new ShareX.HelpersLib.BlackStyleCheckBox();
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();
this.pThumbnail.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbThumbnail)).BeginInit();
this.SuspendLayout();
//
// lblTitle
//
this.lblTitle.AutoEllipsis = true;
this.lblTitle.BackColor = System.Drawing.Color.Transparent;
this.lblTitle.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblTitle.ForeColor = System.Drawing.Color.White;
this.lblTitle.Location = new System.Drawing.Point(0, 0);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(256, 22);
this.lblTitle.TabIndex = 1;
this.lblTitle.Text = "Test.png";
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lblTitle.MouseClick += new System.Windows.Forms.MouseEventHandler(this.LblTitle_MouseClick);
//
// ttMain
//
this.ttMain.AutoPopDelay = 5000;
@ -64,19 +50,6 @@ private void InitializeComponent()
this.ttMain.ReshowDelay = 100;
this.ttMain.Draw += new System.Windows.Forms.DrawToolTipEventHandler(this.TtMain_Draw);
//
// 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.Location = new System.Drawing.Point(8, 8);
this.cbSelected.Name = "cbSelected";
this.cbSelected.Size = new System.Drawing.Size(13, 13);
this.cbSelected.SpaceAfterCheckBox = 3;
this.cbSelected.TabIndex = 2;
this.cbSelected.Visible = false;
//
// pThumbnail
//
this.pThumbnail.BackColor = System.Drawing.Color.Transparent;
@ -93,6 +66,19 @@ private void InitializeComponent()
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)
@ -122,6 +108,20 @@ private void InitializeComponent()
this.pbThumbnail.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PbThumbnail_MouseMove);
this.pbThumbnail.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PbThumbnail_MouseUp);
//
// lblTitle
//
this.lblTitle.AutoEllipsis = true;
this.lblTitle.BackColor = System.Drawing.Color.Transparent;
this.lblTitle.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblTitle.ForeColor = System.Drawing.Color.White;
this.lblTitle.Location = new System.Drawing.Point(0, 0);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(256, 22);
this.lblTitle.TabIndex = 1;
this.lblTitle.Text = "Test.png";
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lblTitle.MouseClick += new System.Windows.Forms.MouseEventHandler(this.LblTitle_MouseClick);
//
// TaskThumbnailPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);