删除 BindingNavigator 上的下划线

发布于 2024-12-28 17:56:27 字数 200 浏览 0 评论 0原文

当我将 BindingNavigator 添加到表单时,它的下方会显示一行。我怎样才能摆脱那条线?

在此处输入图像描述

我已经查看了属性中的所有设置,但我不知道如何摆脱它线。我也在网上查了一下,但找不到任何东西,但我不是唯一想删除它的人。有什么建议吗?

When I add a BindingNavigator to my forms it has a line that appears under it. How can I get rid of that line?

enter image description here

I have looked through all of the settings in the properties but I cannot tell how I can get rid of that line. I have also looked online and can't find anything, but I cannot be the only person who wants to remove this. Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

空名 2025-01-04 17:56:27

如果不实现子类并覆盖 OnPaint 或执行其他一些替换或修改内置渲染的黑客操作,您可能无法做到这一点。这种方法的问题在于 BindingNavigator 可能是一个复合控件,这意味着有一堆按钮控件和一个文本框控件等,它们都自行处理一部分渲染。完全依靠您自己来呈现控件是很困难的。

You probably can't without implementing a subclass and overriding the OnPaint, or doing some other hack where you're replacing or modifying the built in rendering. The problem with this approach is that the BindingNavigator is probably a composite control, meaning there are a bunch of button controls, and a text box control, etc. that all handle a portion of the rendering themselves. It would be difficult to render the control entirely on your own.

不弃不离 2025-01-04 17:56:27

您可以尝试创建自己的渲染器,在其中省略渲染边框:

public class BorderlessRenderer : ToolStripRenderer {
  protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) {
    //base.OnRenderToolStripBorder(e);
  }
}

然后从代码中,您可以将其应用到导航器:

public Form1() {
  InitializeComponent();
  bindingNavigator1.Renderer = new BorderlessRenderer();  
}

不幸的是,我认为此方法也可能隐藏分隔线。

You can try creating your own renderer where you omit the border from being rendered:

public class BorderlessRenderer : ToolStripRenderer {
  protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) {
    //base.OnRenderToolStripBorder(e);
  }
}

then from code, you can apply it to your navigator:

public Form1() {
  InitializeComponent();
  bindingNavigator1.Renderer = new BorderlessRenderer();  
}

Unfortunately, I think this method might hide the separator lines, too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文