VB.NET改变标题栏颜色 [英] VB.NET Change Titlebar color

查看:245
本文介绍了VB.NET改变标题栏颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在几个论坛中搜索了这个主题,并且在大多数情况下建议我创建一个无边框表单并绘制我自己的标题栏和边框,然后处理所有移动和调整大小的事件。我不想使用这种方法。相反,我想使用Windows API来重新着色标题栏和边框。我无法在VB.NET中找到任何实际工作的代码示例。



有没有人成功重新着色.Net表格标题栏?如果是这样,请分享代码。最好在VB

I have searched this topic in several forums and in most cases it is suggested that I create a borderless form and draw my own titlebar and borders and then handle all the moving and resizing events. I do not want to use this approach. Instead I want to use the windows API to ONLY recolor the titlebar and borders. I have not been able to find any code examples in VB.NET that actually work.

Has anyone ever successfully re-colored a .Net form titlebar? If so, please share the code. Preferably in VB

推荐答案

没有Windows API调用来设置标题栏颜色。正如Dave所说,在代码中重新创建标题栏很痛苦,但如果你使用WPF或Silverlight则不那么困难。
There is no Windows API call to set the title bar color. As Dave mentioned, it''s a pain to recreate the title bar in code, but it''s less difficult if you are using WPF or Silverlight.


你必须绘制整个非客户区域的形式自己。您没有找到任何代码来执行此操作的原因是因为没有人这样做。这是一个巨大的痛苦,几乎没有任何好处。
You would have to draw the entire non-client area of the form yourself. The reason you don''t find any code to do this is because nobody does it. It''s a giant pain in the ass with little to no benefit.


我能够使用我在这里发布的代码得到我想要的东西:

< a href =http://www.codeproject.com/Questions/597780/DrawingplusGraphicsplusinplusTitlebarplusinplusWin>在Windows 7的标题栏中绘制图形 [ ^ ]



但是,它只适用于XP。我猜这就是为什么我无法获得任何其他代码示例的文章。在获取Windows消息和绘制图形后的Windows 7中,Windows再次绘制了客户边框和标题栏。在XP中不会发生这种情况。



非常感谢您花时间阅读本文并提供一些想法!
I was able to get what I want using the code I posted here:
Drawing Graphics in Titlebar in Windows 7[^]

However, it only works in XP. I am guessing that this is why i could not get any of the other articles with code samples to work. In windows 7 after getting the windows messages and drawing the graphics, the customer border and titlebar is drawn over again by Windows. This does not happen in XP.

Many thanks for taking the time to read this and offering some ideas!


这篇关于VB.NET改变标题栏颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆