c# winform tooltip显示问题 win7 32位 旗舰版下 tooltip背景色无效 求解释。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在窗口和按钮上使用视觉样式后 tooltip背景色就无效了!真是让人蛋疼啊。 将win7的视觉效果中的 在窗口和按钮上显示视觉效果 选项去掉就好了 ! 但是这样win7 的界面就难看了! 求较好的解决方案 ! 难道要用自定义 tooltip 首先设置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); 早上在解决这个问题的时候,也在想微软当时为什么不定义属性来进行切换,必须要自己绘制。细看后才发现,微软在MSDN上对此控件类的备注里有一句话如下:通常,ToolTip 由操作系统绘制,但是若要自定义 ToolTip 的外观,可将 OwnerDraw 属性设置为 true 并处理 Draw 事件。 http://msdn.microsoft.com/zh-cn/library/system.windows.forms.tooltip.ownerdraw(v=vs.80).aspx .net窗体程序中数据库里添加内容后紧接着查询查不到刚添加的内容,重新运行就查到了,怎么能不重新运行就查到呢? vb代码怎么转成C#的 有难度的问题来了!速速进来 如何生成非中间语言的C#目标程序 请问下C#如何PING如何器,这样才得知服务器是否运行正常 一个关于socket通讯的问题,呵呵 如何在PPC2003操作系统上读取文件至数组中?解决给100分!! 关于多行文本框的显示问题,急。。。 C#配置问题请高手解答 问一个方法的应用 byte[]和字符串的转换问题,涉及到CRC16校验! 高分求救 懂C# 调用C++Dll的请进,
真是让人蛋疼啊。
然后在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);