【问题标题】:TreeView Imagelist showing with white bordersTreeView Imagelist 显示白色边框
【发布时间】:2020-12-22 11:29:42
【问题描述】:

我得到的行为:

预期行为:

我将父背景颜色从主窗体传递给 TreeView 所在的 TreeView 和 UserControl。但是,它似乎仍然无法正常工作......为什么即使图片是 PNG 并且具有透明背景,我也会不断得到白色边框。

【问题讨论】:

  • 重点在控件上。如果您将焦点更改为另一个对象,边框应该会消失。
  • PNG 支持透明,这也意味着它“支持”抗锯齿的半透明像素,这通常会导致这种情况。你需要摆脱他们!请参阅 here 和辅助函数 here

标签: c# winforms


【解决方案1】:

您是否尝试过更改 ImageList 的 ColorDepth 属性?这对我有用:

imageList.ColorDepth = ColorDepth.Depth32Bit;

Related Question.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-23
    • 1970-01-01
    • 2011-03-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多