VB 图形处理

来源:百度知道 编辑:UC知道 时间:2024/09/28 08:19:16
用VB 做个程序 导入一个位图 用鼠标点击 就可以显示点击地方的 RGB 的各个值 做好还有三维图 一起显示 谢谢各位大侠啦~!~

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Cls
Dim sj As Long
Dim ColorZ(1 To 3) As Byte
sj = Me.Point(X, Y)
ColorZ(1) = (sj Mod 65536) Mod 256 'Red
ColorZ(2) = (sj Mod 65536) \ 256 'Green
ColorZ(3) = sj \ 65536 'Blue
Print "Red="; (Val(sj) Mod 65536) Mod 256 'Red
Print "Green="; (Val(sj) Mod 65536) \ 256 'Green
Print "Blue="; Val(sj) \ 65536 'Blue
Shape1.FillColor = RGB(ColorZ(1), ColorZ(2), ColorZ(3))
End Sub
可以读取任一点的RGB数值

给你两个API函数getpixel和 setpixelv
返回指定场景的一格像素的RGB
设置指定场景的一格像素的RGB
在模块里面声明API
在用mousemove时间来导入X,Y
就这了~~自己多思考点