为什么在C#中运行应用程序时按钮周围出现白色边框

时间:2019-02-18 17:52:40

标签: c# user-interface interface

enter image description here

启动应用程序时,表单中的按钮周围出现白色边框。当我单击表单上的其他任何位置时,该按钮将变为正常状态。我在按钮上使用了平面样式,但并未在按钮上添加边框。看来此边框是由选项卡按钮引起的。如何从应用程序中删除此奇怪的边框。

这是按钮的设置。

  this.homeButton.Anchor = ((System.Windows.Forms.AnchorStyles) 
  (((System.Windows.Forms.AnchorStyles.Top | 
  System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
        this.homeButton.BackColor = System.Drawing.Color.Transparent;
        this.homeButton.BackgroundImageLayout = 
 System.Windows.Forms.ImageLayout.None;
        this.homeButton.FlatAppearance.BorderSize = 0;
        this.homeButton.FlatAppearance.MouseOverBackColor = 
 System.Drawing.Color.FromArgb(((int)(((byte)(231)))), ((int)(((byte) 
 (76)))), ((int)(((byte)(60)))));
        this.homeButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
        this.homeButton.Font = new System.Drawing.Font("Century Gothic", 
 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 
 ((byte)(0)));
        this.homeButton.ForeColor = System.Drawing.Color.White;
        this.homeButton.Image = 
 global::CEFSharpBrowserTesting.Properties.Resources.user_icon_16;
        this.homeButton.ImageAlign = 
 System.Drawing.ContentAlignment.MiddleLeft;
        this.homeButton.Location = new System.Drawing.Point(11, 12);
        this.homeButton.MaximumSize = new System.Drawing.Size(0, 33);
        this.homeButton.MinimumSize = new System.Drawing.Size(192, 33);
        this.homeButton.Name = "homeButton";
        this.homeButton.Size = new System.Drawing.Size(192, 33);
        this.homeButton.TabIndex = 3;
        this.homeButton.Text = "    Home";
        this.homeButton.TextImageRelation = 
        System.Windows.Forms.TextImageRelation.ImageBeforeText;
        this.homeButton.UseVisualStyleBackColor = false;
        this.homeButton.Click += new 
        System.EventHandler(this.homeButton_Click);

0 个答案:

没有答案