TreeView控件有复选框属性,但它会在每个节点上放置一个复选框。我该如何只在我想要的节点上放置复选框?
private Image CreateCheckBoxGlyph(CheckBoxState state)
{
Bitmap Result = new Bitmap(imlCheck.ImageSize.Width, imlCheck.ImageSize.Height);
using (Graphics g = Graphics.FromImage(Result))
{
Size GlyphSize = CheckBoxRenderer.GetGlyphSize(g, state);
CheckBoxRenderer.DrawCheckBox(g,
new Point((Result.Width - GlyphSize.Width) / 2, (Result.Height - GlyphSize.Height) / 2), state);
}
return Result;
}
我放弃了使用TreeView,因为它有限且存在缺陷。
你应该能够通过使用开源的TreeViewAdv轻松实现这种行为。