GetPixel函数为什么有时候会返回-1 ?

tinafang 2003-03-31 04:20:15
为什么呢?大部分时候都可以返回正常的值,但有的时候为什么确返回失败呢?
...全文
297 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
tinafang 2003-04-02
  • 打赏
  • 举报
回复
It is when the pixel is outside of the current clipping region that I really want to know !!
用户 昵称 2003-04-01
  • 打赏
  • 举报
回复
那是因为getpixel返回的long有符号
dim l as long
l = getpixel( ... )
if l < 0 then
l = l + 2^31
end if
dsclub 2003-03-31
  • 打赏
  • 举报
回复
The return value is the RGB value of the pixel. If the pixel is outside of the current clipping region, the return value is CLR_INVALID.

Const CLR_INVALID As Long = &HFFFF

Debug.Print CLR_INVALID

结果就是-1了。


Debug.Print Hex(CLR_INVALID)
结果就是FFFFFFFF了。


懂了?

1,486

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧