Option ExplicitPrivate Sub Form_Load() Picture1.AutoRedraw = True Form1.Picture1.PSet (800, 800), RGB(255, 0, 0)'画一个红色的点 End Sub
按座标点:(x(i), y(i))建立二维数组,并保存到文本文件中即可。 dim LPoint(100,100) ......... 建立100个点,然后画点,也可保存: (123,45) (237,89) .......
'窗体加上一张背景图片Private Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long) As Long Private Declare Function SetPixelV Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long Dim colorval&, red&, green&, blue&, x1&, y1&, x2&, y2&, i%, j%, color$Private Sub Form_Load() Me.AutoRedraw = False Me.ScaleMode = 3 End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) colorval = GetPixel(Me.hDC, X, Y) Me.Caption = CStr(X) & "," & CStr(Y) & Space(5) & CStr(colorval) & Space(5) & GetRGB(colorval) If Button <> 0 Then SetPixelV Me.hDC, X, Y, QBColor(Int(Rnd * 16)) End SubPublic Function GetRGB(Cval&) As String red = colorval Mod 256 green = (colorval \ 256) Mod 256 blue = colorval \ 256 \ 256 GetRGB = CStr(red) & "," & CStr(green) & "," & CStr(blue) End Function
我只知道
Form1.Picture1.PSet (x(i), y(i))
窗体.图片控件1.这就不知道了 后面也不知道了.
Picture1.AutoRedraw = True
Form1.Picture1.PSet (800, 800), RGB(255, 0, 0)'画一个红色的点
End Sub
dim LPoint(100,100)
.........
建立100个点,然后画点,也可保存:
(123,45)
(237,89)
.......
Private Declare Function SetPixelV Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Dim colorval&, red&, green&, blue&, x1&, y1&, x2&, y2&, i%, j%, color$Private Sub Form_Load()
Me.AutoRedraw = False
Me.ScaleMode = 3
End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
colorval = GetPixel(Me.hDC, X, Y)
Me.Caption = CStr(X) & "," & CStr(Y) & Space(5) & CStr(colorval) & Space(5) & GetRGB(colorval)
If Button <> 0 Then SetPixelV Me.hDC, X, Y, QBColor(Int(Rnd * 16))
End SubPublic Function GetRGB(Cval&) As String
red = colorval Mod 256
green = (colorval \ 256) Mod 256
blue = colorval \ 256 \ 256
GetRGB = CStr(red) & "," & CStr(green) & "," & CStr(blue)
End Function