[英]Access a ListView located in a UserControl from the MainForm in Winforms
[英]Removing Border from WinForms UserControl
我有带有黑色边框的 UserControl。 我想删除边框或更改其颜色。
.
找到解决方案,但它没有删除边框:
public FolderView() {
InitializeComponent();
base.BorderStyle = BorderStyle.None;
this.BorderStyle = BorderStyle.None;
}
private BorderStyle border;
public new BorderStyle BorderStyle {
get { return border; }
set {
border = value;
Invalidate();
}
}
控制来自这个项目。
更新:我正在尝试绘制新边框。 在TreeListView
class 的OnPaint
方法末尾添加了这些代码行:
Rectangle rect = base.ClientRectangle;
ControlPaint.DrawBorder(e.Graphics, rect, Color.DarkBlue, ButtonBorderStyle.Solid);
然而,垂直滚动条画在我的边框上。 如何解决这个问题? 还在FolderViewTree
中尝试了相同的代码,但滚动条将边框推向左侧(我希望在边框内有滚动条,因为它原来是这样)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.