简体   繁体   English

用于在所有Win32程序员的Windows Aero Glass(DWM,GDI,GDI +)上绘图的文档和API示例

[英]Documentation and API Samples for drawing on Windows Aero Glass (DWM, GDI, GDI+) for all Win32 programmers

I am looking for good resources for learning to use the Win32/GDI APIs or whatever supercedes it to draw and paint directly using the Win32 API to a glass form. 我正在寻找学习使用Win32 / GDI API的好资源,或者使用Win32 API直接绘制和绘制到玻璃表格的任何东西。

While I am using Delphi, I tagged this as Delphi or Visual C++. 当我使用Delphi时,我将其标记为Delphi或Visual C ++。 Any code samples and articles that you can find would be appreciated. 您可以找到任何代码示例和文章,我们将不胜感激。 MSDN articles do not seem to be written about this. MSDN文章似乎没有写到这一点。

As a goal, let's imagine you want to either: (a) Reproduce what Google Chrome does (tabs as part of the glass frame) (b) Reproduce what MS Office 2010 does (save button on the glass frame, referred to in MFC for VS 2010, as "Quick Access Toolbar" (see picture below). 作为一个目标,让我们想象你想要:(a)重现谷歌Chrome的功能(标签作为玻璃框架的一部分)(b)重现MS Office 2010的功能(保存在MFC上的玻璃框架上的按钮VS 2010,作为“快速访问工具栏”(见下图)。

I am not using MFC, but if examining the MFC sources would be a good source of information, I am curious to know where in the MFC sources or BCG original sources (I have both) are implemented the Quick Access Toolbar rendering/painting code. 我没有使用MFC,但如果检查MFC源是一个很好的信息来源,我很想知道在MFC源或BCG原始源(我有两者)中的哪些地方实现了快速访问工具栏渲染/绘制代码。

替代文字

Update: A related neato link from one of the answers below shows the NC (nonclient) Paint message, and how to handle it when painting on a glass frame, and an MSDN article about it here . 更新:以下答案之一的相关neato链接显示NC(非客户端)Paint消息,以及如何在玻璃框架上绘制时处理它,以及此处的MSDN文章。

This is a subset of my "Glass" bookmarks folder, the result of a lot of research / searching on this topic. 这是我的“Glass”书签文件夹的一个子集,是对该主题进行大量研究/搜索的结果。 I've found all of these useful for learning about glass and solving various problems drawing on it. 我发现所有这些对于学习玻璃和解决各种问题都很有用。 Most of these include Delphi code, but I've noted where it's for another language. 其中大部分包括Delphi代码,但我已经注意到它用于另一种语言。

Plain Glass links 普通玻璃链接

  • Using translucent windows with Delphi : good introduction (from the very basics) for using Glass in Delphi forms 使用Delphi的半透明窗口 :在Delphi表单中使用Glass的良好介绍(从非常基础)
  • Custom drawing on glass : covers how to draw a bitmap or other image on a glass area of the window. 在玻璃上自定义绘图 :介绍如何在窗口的玻璃区域上绘制位图或其他图像。 Covers alpha channels etc too, good overview 也包括alpha通道等,很好的概述
  • Using glass in a VC++ project : covers turning glass on, drawing text, handling notifications etc - a good general introduction to how it works. 在VC ++项目中使用玻璃 :包括打开玻璃,绘制文本,处理通知等 - 这是一个很好的一般介绍它的工作原理。 A lot of the underlying details are handled by the VCL (eg the GlassFrame property and TForm internals look after a lot of this) but it's very useful to understand the basics of how it's implemented at an API level anyway 很多底层细节都是由VCL处理的(例如GlassFrame属性和TForm内部机构会考虑很多这些),但是理解它在API级别实现的基础知识非常有用。
  • How to draw on the non-client area : this shows how to draw something like Office's toolbar in the title bar. 如何在非客户区绘制:这显示了如何在标题栏中绘制Office的工具栏。 .Net code, but translatable .Net代码,但可翻译
  • Setting up a custom title bar : very detailed article about non-client-area drawing (in Delphi, so Delphi code). 设置自定义标题栏 :非常详细的关于非客户区绘图的文章(在Delphi中,所以Delphi代码)。 Followed up by part 2 , which demonstrates completely taking over the entire window and mimicking the standard title bar yourself. 后续第2部分 ,演示完全接管整个窗口并自己模仿标准标题栏。 These two articles will let you mimic Office and Chrome as you requested in the question 这两篇文章将让您按照问题中的要求模仿Office和Chrome
  • How to set up various VCL controls to work best on a glass area : the VCL does not support glass very well. 如何设置各种VCL控件以在玻璃区域上发挥最佳效果 :VCL不能很好地支持玻璃。 You'll often get artifacts, or controls simply not drawing properly at all, no matter what you do to try and solve it. 无论你做什么尝试和解决它,你经常会得到文物,或控制根本就没有正确绘制。 This article lists the basic VCL visual components (labels, buttons, progress bars, etc) and what to set up for each so they draw perfectly, or at least 'as well as possible' when they're placed on a glass area 本文列出了基本的VCL可视化组件(标签,按钮,进度条等)以及为每个组件设置的内容,以便在将它们放置在玻璃区域时完美地绘制,或者至少“尽可能”绘制

Advanced, or tangentially related: 高级或切向相关:

These posts on drawing a custom title bar under Vista/Windows 7 might interest you. 在Vista / Windows 7下绘制自定义标题栏的这些 帖子可能会让您感兴趣。

Sample image: 示例图片:

样品

I'm sure you've found the MSDN page about the DWM . 我确定你找到了关于DWMMSDN页面 It has jumps many topics and a few examples. 它已经跳过很多主题和一些例子。 Some of the "overview" articles there have examples (like the DWM Blur Behind Overview ). 一些“概述”文章中有一些例子(如DWM Blur Behind Overview )。

Unfortunately, other than the documentation, there are precious few good articles. 不幸的是,除了文档之外,还有很少的好文章。 You can start with Using glass on codeproject , and take a look at a detecting glass in delphi - after that using the functions straight from the docs is not too bad. 您可以从codeproject上的Using glass开始,然后在delphi中查看检测玻璃 - 之后直接使用docs中的函数也不错。 Luckily they are all pretty straight-forward in practice. 幸运的是,他们在练习中都非常直截了当。

Good web site for glass components, including a Glass button: 适用于玻璃组件的良好网站,包括玻璃按钮:

http://rmklever.com/ http://rmklever.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM