使用SetClassLongPtr [英] Using SetClassLongPtr

查看:257
本文介绍了使用SetClassLongPtr的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我试图通过使用MFC中的SetClassLongPtr更改画笔来更改对话框背景颜色.

它不起作用.

我应该在哪里拨打电话才能正常通话?

谢谢,
Vaibhav.

Hi,
I am trying to change dialog background color by changing brush using SetClassLongPtr in MFC.

Its not working.

Where do i put the call so that it will work?

Thanks,
Vaibhav.

推荐答案

作为 ^ ]表示:

As the MSDN Help[^]indicates:

''Use the SetClassLongPtr function with care. For example, it is possible to change the background color for a class by using SetClassLongPtr, but this change does not immediately repaint all windows belonging to the class. ''



因此,我建议您在调用SetClassLongPtr() ...



So I would suggest performing this as part of your OnInitDialog() or calling and InvalidateRect() after you''ve called SetClassLongPtr()...


Hi,
后,在您的OnInitDialog()或调用InvalidateRect()的一部分中执行此操作
我这样编码:

Hi,

I have coded like this:

OnInitDialog
{
    <pre>SetClassLongPtrW(GetSafeHwnd(), GCLP_HBRBACKGROUND, (LONG_PTR)GetStockObject(WHITE_BRUSH));

   CRect rect;
   GetWindowRect(&amp;rect);
   InvalidateRect(&amp;rect);


}

但是Dialog的背景颜色不变.

建议我使用SetClassLongPtr更改背景颜色的方法.

谢谢,
Vaibhav.


}

But Dialog''s background color is not changed.

Suggest me way to use SetClassLongPtr to change background color.

Thanks,
Vaibhav.


这篇关于使用SetClassLongPtr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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