本文介绍了使用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.
推荐答案
''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()
...
OnInitDialog
{
<pre>SetClassLongPtrW(GetSafeHwnd(), GCLP_HBRBACKGROUND, (LONG_PTR)GetStockObject(WHITE_BRUSH));
CRect rect;
GetWindowRect(&rect);
InvalidateRect(&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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!