单击文本或复选框后显示矩形

时间:2014-01-18 08:16:47

标签: c# winforms checkbox

我有一个带有一些复选框的窗口应用程序。这些复选框有一个图像,外观设置为按钮。

我的问题是,当我点击复选框时,复选框周围会出现一个矩形,如下所示。我没有得到为避免这个矩形而设置的属性。

enter image description here

this.chkboxReportSelect.Appearance = System.Windows.Forms.Appearance.Button;
this.chkboxReportSelect.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(215)))), ((int)(((byte)(221)))), ((int)(((byte)(228)))));
this.chkboxReportSelect.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(215)))), ((int)(((byte)(221)))), ((int)(((byte)(228)))));
this.chkboxReportSelect.FlatAppearance.BorderSize = 0;
this.chkboxReportSelect.FlatAppearance.CheckedBackColor = System.Drawing.Color.Transparent;
this.chkboxReportSelect.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent;
this.chkboxReportSelect.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
this.chkboxReportSelect.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.chkboxReportSelect.Image = global::M3.AKFRW.UI.Properties.Resources.checkmark;
this.chkboxReportSelect.Location = new System.Drawing.Point(3, 3);
this.chkboxReportSelect.Name = "chkboxReportSelect";
this.chkboxReportSelect.Size = new System.Drawing.Size(124, 24);
this.chkboxReportSelect.TabIndex = 27;
this.chkboxReportSelect.Text = "Select Report ";
this.chkboxReportSelect.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.chkboxReportSelect.UseCompatibleTextRendering = true;
this.chkboxReportSelect.UseVisualStyleBackColor = false;

1 个答案:

答案 0 :(得分:1)

我确定您正在使用FlatStyle。您看到的矩形是FlatStyle的边框,您可以通过将BorderSize的{​​{1}}设置为FlatAppearance

来摆脱它
0