0
点赞
收藏
分享

微信扫一扫

dev treelist控件,显示3角符,或显示+ -符的控制


解决方案1:

  在 program.cs中把 下面一句暂时注解,你就会发现所有的 treelist会自动显示 + -号;

     如果放出来,就显示3角符

        DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("DevExpress Style");

解决方案2:

   自己画+-号

private void treeList1_CustomDrawNodeButton(object sender, DevExpress.XtraTreeList.CustomDrawNodeButtonEventArgs e)
{
Brush backBrush = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, Color.White, Color.Black,
System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal);
e.Graphics.FillRectangle(backBrush, e.Bounds);
// painting 3D borders
ControlPaint.DrawBorder3D(e.Graphics, e.Bounds, Border3DStyle.Flat);

// determining the character to display
string displayCharacter = e.Expanded ? "-" : "+";
// formatting the output character
StringFormat outCharacterFormat = new StringFormat();
outCharacterFormat.Alignment = StringAlignment.Center;
outCharacterFormat.LineAlignment = StringAlignment.Center;

// painting the character
e.Graphics.DrawString(displayCharacter, new Font("Verdana", 8),
new SolidBrush(Color.White), e.Bounds, outCharacterFormat);

// prohibiting default painting
e.Handled = true;

}

 

 

举报

相关推荐

0 条评论