win7 32位 旗舰版下 tooltip背景色无效 求解释。

解决方案 »

  1.   

    在窗口和按钮上使用视觉样式后  tooltip背景色就无效了!
    真是让人蛋疼啊。
      

  2.   

    将win7的视觉效果中的 在窗口和按钮上显示视觉效果 选项去掉就好了 ! 但是这样win7 的界面就难看了! 求较好的解决方案 !  难道要用自定义 tooltip
      

  3.   

    首先设置tooltip控件的OwnerDraw属性为True(由用户自己来绘制,不使用系统绘制)
    然后在tooltip的Draw事件下加入自绘制代码,下面五行                Graphics g = e.Graphics;
                    g.FillRectangle(new SolidBrush(this.toolTip1.BackColor), g.ClipBounds);
                    e.Graphics.DrawLines(SystemPens.ControlLightLight, new Point[] { new Point(0, e.Bounds.Height - 1), new Point(0, 0), new Point(e.Bounds.Width - 1, 0) });
                    e.Graphics.DrawLines(SystemPens.ControlDarkDark, new Point[] { new Point(0, e.Bounds.Height - 1), new Point(e.Bounds.Width - 1, e.Bounds.Height - 1), new Point(e.Bounds.Width - 1, 0) });
                    TextFormatFlags sf = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter | TextFormatFlags.NoFullWidthCharacterBreak;
                    e.DrawText(sf);
      

  4.   

    早上在解决这个问题的时候,也在想微软当时为什么不定义属性来进行切换,必须要自己绘制。细看后才发现,微软在MSDN上对此控件类的备注里有一句话如下:通常,ToolTip 由操作系统绘制,但是若要自定义 ToolTip 的外观,可将 OwnerDraw 属性设置为 true 并处理 Draw 事件。
      

  5.   

    http://msdn.microsoft.com/zh-cn/library/system.windows.forms.tooltip.ownerdraw(v=vs.80).aspx