现在的位置: 首页 > 综合 > 正文

winform datagridview 自定义tooltip

2012年09月21日 ⁄ 综合 ⁄ 共 524字 ⁄ 字号 评论关闭

代码如下:

 

View Code
1 private void toolTip1_Draw(object sender, DrawToolTipEventArgs e)
2         {
3            e.Graphics.DrawEllipse(Pens.Red, e.Bounds);
4             
5             e.Graphics.FillRectangle(Brushes.Blue, e.Bounds);
6        // e.Graphics.DrawRectangle(Pens.Chocolate, new Rectangle(0, 0, e.Bounds.Width - 1, e.Bounds.Height - 1));
7         e.Graphics.DrawString(this.toolTip1.ToolTipTitle + e.ToolTipText, e.Font, Brushes.Red, e.Bounds);
8     
9         }

 

注意,为了显示上述的这种效果,必须设置OwnerDraw的值为true;并且isballoon的值为false。

 

 

 

抱歉!评论已关闭.