简体   繁体   English

单击后边框内的C#winform按钮

[英]C# winform button inside border after click

I have been spending over 2 hours to try fix this but I can't, really angry and stress with this. 我已经花了2个小时以上的时间来尝试解决此问题,但是我不能为此感到非常生气和压力。

在此处输入图片说明

You can easily seen the black border insde Sign in button, it's show when I click. 您可以轻松地看到insde登录按钮的黑色边框,单击该按钮即会显示。

I have googled plenty of times but I can't fix that. 我已经用Google搜索了很多次,但是我无法解决。

Some one told me do that, not working. 有人告诉我这样做,不起作用。

public class MyButton : Button
{
    public override void NotifyDefault(bool value)
    {
        base.NotifyDefault(false);
    }
}

I've done this too but get nothing: C# WinForms - custom button unwanted border when form unselected 我也这样做,但一无所获: C#WinForms-未选择表单时自定义按钮不需要的边框

That rectangle indicates that your Button has focus. 该矩形表示您的Button具有焦点。 It doesn't make too much sense to hide it; 隐藏它没有太大的意义。 however, it is possible to do so: 但是,可以这样做:

public class MyButton : Button
{
    protected override bool ShowFocusCues
    {
        get { return false; }
    }
}

I have found solutions, this really simple and this answer for who have similar question. 我找到了解决方案,这真的很简单,对于有类似问题的人也可以找到答案。

Problem is button focus, to handle this, simplest way is 问题是按钮焦点,要解决这个问题,最简单的方法是

private void Form1_Load(object sender, EventArgs e)
{
    this.Select();
}

Thanks everybody for helping me. 谢谢大家的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM