我有一个带有一些复选框的窗口应用程序。这些复选框有一个图像,外观设置为按钮。
我的问题是,当我点击复选框时,复选框周围会出现一个矩形,如下所示。我没有得到为避免这个矩形而设置的属性。
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;
答案 0 :(得分:1)
我确定您正在使用FlatStyle
。您看到的矩形是FlatStyle的边框,您可以通过将BorderSize
的{{1}}设置为FlatAppearance
0