Search code examples
c#winformsdevexpress

Devexpress Checkbutton Blueline border - how to remove


I am currently working on a devexpress project and I am using the checkbutton tool. I have it doing everything I want except for a very annoying sick looking blueline that shows up on appearance.hover and appearance.pressed.

If anything at all I would expect a color that goes with the theme but a constant blueline no matter what skin is selected is annoying and feels like an old html design.

I have tried setting the bordercolor and all but still.

Below is my code of what I have tried by far from form.Designer.cs;

this.cBtnFilter.AllowFocus = false;
this.cBtnFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cBtnFilter.AppearanceDisabled.Options.UseBackColor = true;
this.cBtnFilter.AppearanceHovered.BorderColor = System.Drawing.Color.White;
this.cBtnFilter.AppearanceHovered.Options.UseBackColor = true;
this.cBtnFilter.AppearanceHovered.Options.UseBorderColor = true;
this.cBtnFilter.AppearancePressed.BorderColor = System.Drawing.Color.White;
this.cBtnFilter.AppearancePressed.Options.UseBackColor = true;
this.cBtnFilter.AppearancePressed.Options.UseBorderColor = true;
this.cBtnFilter.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.False;
this.cBtnFilter.ImageOptions.Location = DevExpress.XtraEditors.ImageLocation.MiddleCenter;
this.cBtnFilter.ImageOptions.SvgImage = global::form.Properties.Resources.icon_filter;
this.cBtnFilter.ImageOptions.SvgImageSize = new System.Drawing.Size(40, 40);
this.cBtnFilter.Location = new System.Drawing.Point(355, 40);
this.cBtnFilter.LookAndFeel.SkinName = "The Bezier";
this.cBtnFilter.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.UltraFlat;
this.cBtnFilter.LookAndFeel.UseDefaultLookAndFeel = false;
this.cBtnFilter.Name = "cBtnFilter";
this.cBtnFilter.PaintStyle = DevExpress.XtraEditors.Controls.PaintStyles.Light;
this.cBtnFilter.ShowFocusRectangle = DevExpress.Utils.DefaultBoolean.False;
this.cBtnFilter.Size = new System.Drawing.Size(50, 50);
toolTipTitleItem4.Text = "Show active Only";
superToolTip4.Items.Add(toolTipTitleItem4);
this.cBtnFilter.SuperTip = superToolTip4;
this.cBtnFilter.TabIndex = 39;
this.cBtnFilter.Click += new System.EventHandler(this.Filter_Click);

The attached image is an example of when it is selected and when it is hovered respectively.

At the least if I could completely remove the blue line or change it to the theme color. It would be great.

Am using Devexpress Version 20.2.4

enter image description here


Solution

  • how I solved this is by using the simple button instead and making it act like a toggle button.

    this method handles the toggle for me

    public Boolean buttonState = false;
    
    private void ToggleButton()
            {
                if (buttonState)
                {
                    simpleButton.Appearance.BackColor = Color.Red;
                    buttonState = false;
                }
                else
                {
                    simpleButton.Appearance.BackColor = Color.White;
                    buttonState = true;
                }
            }
    

    this is the button

    private void simpleButton_Click(object sender, EventArgs e)
    {
        ToggleButton();
    }
    

    here is the button in Designer.cs

    this.simpleButton1.AllowFocus = false;
    this.simpleButton1.AppearanceHovered.BackColor = System.Drawing.Color.Teal;
    this.simpleButton1.AppearanceHovered.Options.UseBackColor = true;
    this.simpleButton1.Location = new System.Drawing.Point(524, 214);
    this.simpleButton1.LookAndFeel.SkinName = "The Bezier";
    this.simpleButton1.LookAndFeel.UseDefaultLookAndFeel = false;
    this.simpleButton1.Name = "simpleButton1";
    this.simpleButton1.ShowFocusRectangle = DevExpress.Utils.DefaultBoolean.False;
    this.simpleButton1.Size = new System.Drawing.Size(157, 150);
    this.simpleButton1.TabIndex = 2;
    this.simpleButton1.Text = "simpleButton";
    this.simpleButton1.Click += new System.EventHandler(this.simpleButton1_Click);
    

    Its quite straightforward. In case anyone has a better way or has need for this, knock yourself(ves) out.

    Hopefully in the future, Devexpress will not force blue borders on us.