怎么取得屏幕上某点的颜色值?

kedengfeng 2001-07-25 04:06:39
如提
...全文
230 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
xxlroad 2001-07-25
  • 打赏
  • 举报
回复
或 造假 把屏幕拷下来
blldw 2001-07-25
  • 打赏
  • 举报
回复
我想只需要一个API函数,getdibits()
Chice_wxg 2001-07-25
  • 打赏
  • 举报
回复
得到屏幕上的点的颜色:

x=1 '你自己设定
y=1 '你自己设定

hDC=GetDC(0)
color=GetPixel(hdc,x,y)

debug.print "The Point at ";x;" ";y;" is ";hex(color)
chaseismydream 2001-07-25
  • 打赏
  • 举报
回复
在窗体外的点怎么办?不用api吗?
xxlroad 2001-07-25
  • 打赏
  • 举报
回复
Point

应用于
Intersection 对象
返回或设置当前坐标轴与另一坐标轴的相交点。
语法
object.Point [ = point]

Point 属性的语法包含下面部分:
部分 描述

object 对象表达式,其值是“应用于”列表中的对象。
point Double。当前坐标轴与一个轴的相交点。

说明
如果设置了该属性,则 Intersection 对象的 Auto 属性将自动设置为 False。



应用于
Form 对象, Forms 集合, PictureBox 控件, PropertyPage 对象, UserControl 对象, UserDocument 对象
按照长整数,返回在 Form 或 PictureBox 上所指定磅的红-绿-蓝 (RGB) 颜色。不支持命名参数。
语法
object.Point(x, y)

Point 方法的语法包含下列部分:
部分 描述

object 可选的。一个对象表达式 ,该对象一定能在“应用于”列表中找到。 如果省略 object ,带有焦点的 Form 象缺省为 object.
x, y 必需的。均为单精度数值,指示 Form 或 PictureBox 的 ScaleMode 属性中该点的水平(x-轴)和垂直(y-轴)坐标。必须用括号包括这些数值。

说明
如果由 x 和 y 坐标所引用的点位于 object 之外,Point 方法将返回 -1。
示例
Point 方法示例


本示例使用 Point 方法来确定一个窗体上的一个指定点的颜色。要检验此示例,可将本例代码粘贴到一个窗体的声明部分,然后按 F5 键并单击该窗体。
Private Sub Form_Click ()
Dim LeftColor, MidColor, Msg, RightColor ' 声明变量。
AutoRedraw = -1 ' 打开AutoRedraw。
Height = 3 * 1440 ' 将高度设置为 3 英寸。
Width = 5 * 1440 ' 将宽度设置为 5 英寸。
BackColor = QBColor(1) ' 将背景设置为蓝色。
ForeColor = QBColor(4) ' 将前景设置为红色。
Line (0, 0)-(Width / 3, Height), , BF ' 红框。
ForeColor = QBColor(15) ' 将前景设置为白色。
Line (Width / 3, 0)-((Width / 3) * 2, Height), , BF
LeftColor = Point(0, 0) ' 查找左框颜色,,
MidColor = Point(Width / 2, Height / 2) ' 中框, 和
RightColor = Point(Width, Height) ' 右框。
Msg = "The color number for the red box on the left side of "
Msg = Msg & "the form is " & LeftColor & ". The "
Msg = Msg & "color of the white box in the center is "
Msg = Msg & MidColor & ". The color of the blue "
Msg = Msg & "box on the right is " & RightColor & "."
MsgBox Msg ' 显示信息。
End Sub

7,763

社区成员

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

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