使用 WHITE_BRUSH 填充矩形在 WinCE 6.0 上失败
我试图用“但是它“成功”(返回非零)来清除屏幕的一部分,
FillRect(hdc, &r, (HBRUSH)(WHITE_BRUSH))
但不会在屏幕上写入任何内容。如果我将其更改为
FillRect(hdc, &r, (HBRUSH)(WHITE_BRUSH+1))
它,它会神奇地开始工作,但现在它会以浅灰色清除屏幕。我在这里缺少什么吗?
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)(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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
画笔常量不保证是有效的句柄;您应该使用
GetStockObject
来将常量转换为句柄。WHITE_BRUSH+1
的计算结果似乎有效,这可能只是巧合。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 thatWHITE_BRUSH+1
evaluates to something that appears to work.