如何拥有者绘制主窗口的框架? [英] How to owner draw main window's frame ?

查看:99
本文介绍了如何拥有者绘制主窗口的框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!



我想首先感谢所有花时间查看此主题并尝试提供帮助的人。



我需要自定义主窗口的框架以具有以下特征:



- 它显示一个图标(就像和普通窗口一样);



- 它显示标题(就像普通窗口一样)但文字​​是橙色;



- 显示最小化关闭按钮(没有最大化按钮);



- 最小化和关闭的按钮有不同于普通窗口的图标。



我在MS Visual Studio Express 2008中工作,在Windows XP上,在C ++中,使用纯WIN32 API。



如果需要任何其他信息(源代码或类似的东西),请询问,我会非常乐意提供它。

Hello everyone!

I would like to start by saying thanks to everyone who takes some time to view this thread and try to help.

I need to customize main window''s frame to have following characteristics:

- It displays an icon ( just as same as normal window does );

- It displays title ( just like normal window ) but text is in orange color;

- It displays minimize, and close buttons ( there is no maximize button );

- Buttons for minimize and for close have icons different than ones that normal window has.

I work in MS Visual Studio Express 2008, on Windows XP, in C++, using pure WIN32 API.

If any other information is required ( source code or something similar ), please ask for it, I will more than gladly supply it.

推荐答案

这不是ap所有者画的艺术。这是非客户区域,应由非客户端绘图处理,通过处理非客户端消息和消息参数:http://msdn.microsoft.com/en-us/library/windows/desktop/dd162743%28v=vs.85%29.aspx [ ^ ]。



另一种方法可能是有时使用的解决方法,但在更奇特的窗口设计中。您可以使用没有非客户区域的样式创建窗口:没有边框,没有标题栏。在这种情况下,您可以模拟客户区域中的非客户端元素,在这种情况下是整个窗口区域。







回答后续问题,从评论到答案:



This is not a part of owner draw. This is non-client area which should be handled by non-client drawing, via handling non-client messages and message parameters: http://msdn.microsoft.com/en-us/library/windows/desktop/dd162743%28v=vs.85%29.aspx[^].

Another approach could be a work-around which is sometimes used, but in more exotic window designs. You can create window in a style using no non-client areas at all: no borders, no title bar. In this case, you can simulate non-client elements in your client area, which is in this case the whole window area.



Answering follow-up questions, from the comment to this answer:

  1. 非客户绘图将由两部分组成:由OS呈现,以及您在应用程序中绘制的内容,如上文引用的文章中所述。我不认为你可以模拟操作系统绘制的任何东西,你只能在它上面绘制。当然,你也可以禁用一些元素。
  2. 正如我所说,你可以通过它的样式实现一个没有非客户区域的窗口。它可以像

  1. Non-client drawing would be made of two parts: rendered by OS and something you draw in your application the way explained in the article referenced above. I don''t think you can mode anything drawn by OS, you can only draw on top of it. Of course, you can also disable some elements.
  2. As I said, you can achieve a window without non-client areas by its styles. It can be like
SetWindowLong(hWnd, GWL_STYLE, some_styles);

请参阅:

http://msdn.microsoft.com/en-us/library/windows /desktop/ms633591%28v=vs.85%29.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600%28v=vs.85%29 .aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/windows/desktop/ff700543%28v=vs.85%29.aspx [ ^ ]。



I我相信没有一个样式位会出现这样的窗口:

Please see:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633591%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/ff700543%28v=vs.85%29.aspx[^].

I believe that none of the style bits will already make such window:

SetWindowLong(hWnd, GWL_STYLE, 0);





-SA


这篇关于如何拥有者绘制主窗口的框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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