自定义标题栏/铬在WinForms应用程序 [英] Custom titlebars/chrome in a WinForms app

查看:153
本文介绍了自定义标题栏/铬在WinForms应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我几乎可以肯定我知道这个问题的答案,但我希望有件事情我已经忽略了。

某些应用似乎在Windows XP上运行时,Vista的Aero外观和感觉他们的标题栏和按钮均匀。 (谷歌浏览器和Windows Live照片库浮现在脑海中的例子)。我知道一个办法做到这一点从WinForms的是创建一个无国界的形式,绘制标题栏/按钮自己,那么覆盖的WndProc ,以确保移动,调整大小和按钮点击做他们应该做的(我不清楚细节,但很可能把它关闭,给每天阅读文档。)我'很好奇,如果有一个不同的,更简单的方式,我俯瞰。或许有些API调用或窗口风格,我忽略了?

我相信谷歌已经通过使用与铬滚你自己窗口的方式回答了这个问题对我来说。我将离开这个问题打开了另一天,以防有人有新的信息,但我相信我已经回答了这个问题我自己。

解决方案

下面是关于如何使用自己定制的镶边的应用程序完全code样品的一篇文章:

<一个href="http://geekswithblogs.net/kobush/articles/CustomBorderForms3.aspx">http://geekswithblogs.net/kobush/articles/CustomBorderForms3.aspx

这看起来像一些真正的好东西。共有3条在它的系列,它运行很好,而在Vista呢!

I'm almost certain I know the answer to this question, but I'm hoping there's something I've overlooked.

Certain applications seem to have the Vista Aero look and feel to their caption bars and buttons even when running on Windows XP. (Google Chrome and Windows Live Photo Gallery come to mind as examples.) I know that one way to accomplish this from WinForms would be to create a borderless form and draw the caption bar/buttons yourself, then overriding WndProc to make sure moving, resizing, and button clicks do what they're supposed to do (I'm not clear on the specifics but could probably pull it off given a day to read documentation.) I'm curious if there's a different, easier way that I'm overlooking. Perhaps some API calls or window styles I've overlooked?

I believe Google has answered it for me by using the roll-your-own-window approach with Chrome. I will leave the question open for another day in case someone has new information, but I believe I have answered the question myself.

解决方案

Here's an article with full code sample on how to use your own custom "chrome" for an application:

http://geekswithblogs.net/kobush/articles/CustomBorderForms3.aspx

This looks like some really good stuff. There are a total of 3 articles in it's series, and it runs great, and on Vista too!

这篇关于自定义标题栏/铬在WinForms应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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