后createwindow(...),如何给窗口一个颜色? [英] After createwindow(...), how to give the window a color?

查看:185
本文介绍了后createwindow(...),如何给窗口一个颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个窗口,其句柄是handle_parent。然后我创建了一个子窗口如下:

I have created a window whose handle is handle_parent. Then I created a child window as following:

hwnd_child = CreateWindow(child_class_name, _T(""),
WS_CHILDWINDOW, 0, 0, 0, 0, hwnd_parent, (HMENU)0, ghinst, NULL);
ShowWindow(win->hwndSplitterBar, SW_SHOW);
UpdateWindow(win->hwndSplitterBar);

我想设置子窗口child的颜色。如果我什么也不做,颜色默认为灰色。
我如何设置它的颜色?

I would like to set the color of child window "child". If I do nothing, the color is grey by default. How could I set its color? I would like to keep the color as black permanent, do change in anycase.

推荐答案

创建一个所需颜色的画笔,然后将它传递到 hbrBackground 调用 WNDCLASS desktop / ms633586.aspxrel =nofollow> RegisterClass 注册您的窗口类。

Create a brush of the desired color and then pass it in the hbrBackground member of the WNDCLASS struct when calling RegisterClass to register your window class.

当您调用 UnregisterClass 时,系统将自动删除此画笔,因此一旦您将此画笔传递到 RegisterClass 所有关于它,不能尝试自己删除它。

The system will delete this brush automatically when you call UnregisterClass so once you have passed this brush to RegisterClass you can forget all about it and must not attempt to delete it yourself.

这篇关于后createwindow(...),如何给窗口一个颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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