WinForms 应用程序中的自定义标题栏/镶边 [英] Custom titlebars/chrome in a WinForms app

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

问题描述

我几乎可以肯定我知道这个问题的答案,但我希望我忽略了一些东西.

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

即使在 Windows XP 上运行时,某些应用程序的标题栏和按钮似乎也具有 Vista Aero 的外观和感觉.(谷歌浏览器和 Windows Live 照片库作为例子浮现在脑海中.)我知道从 WinForms 实现这一点的一种方法是创建一个无边框表单并自己绘制标题栏/按钮,然后覆盖 WndProc 确保移动、调整大小和按钮点击完成他们应该做的事情(我不清楚具体细节,但可能会花一天时间阅读文档.)我很好奇是否有不同的,我正在俯瞰的更简单的方法.也许我忽略了一些 API 调用或窗口样式?

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?

我相信 Google 已经通过在 Chrome 中使用滚动您自己的窗口方法为我解答了这个问题.如果有人有新信息,我会将问题留待改天,但我相信我自己已经回答了这个问题.

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.

推荐答案

这是一篇关于如何为应用程序使用您自己的自定义chrome"的完整代码示例文章:

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

这看起来是一些非常好的东西.该系列共有 3 篇文章,运行良好,在 Vista 上也运行良好!

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天全站免登陆