开发者

FillRect with WHITE_BRUSH fails on WinCE 6.0

开发者 https://www.devze.com 2023-04-03 19:55 出处:网络
I\'m attempting to clear part of my screen with FillRect(hdc, &r, (HBRUSH)(WHITE_BRUSH)) However it \"succeeds\" (returns nonzero) but writes nothing to the screen. If I change it to

I'm attempting to clear part of my screen with

FillRect(hdc, &r, (HBRUSH)(WHITE_BRUSH))

However it "succeeds" (returns nonzero) but writes nothing to the screen. If I change it to

FillRect(hdc, &r, (HBRUSH)开发者_JAVA技巧(WHITE_BRUSH+1))

it magically starts working, except now it's clearing the screen with a slight gray color. Is there something I am missing here?


The brush constants are not guaranteed to be valid handles; you're supposed to use GetStockObject to convert the constant to a handle. It's probably just a coincidence that WHITE_BRUSH+1 evaluates to something that appears to work.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号