pset et setpixel font la meme chose... elle permettent de changer la couleur d'un pixel.
point et getpixel , eux , permettent de recuperer la couleur d'un pixel.
voici comment on se sert de cela....
ok , crée une nouvelle Form , ajoutes une picture box , et un bouton
insere ce code...
Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
'mettre a 1 pour utiliser les API
#Const UtiliserAPI = 1
Private Sub Command1_Click()
#If UtiliserAPI = 0 Then
Picture1.AutoRedraw = True
#End If
Randomize
For y = 0 To Picture1.ScaleHeight
For x = 0 To Picture1.ScaleWidth
#If UtiliserAPI = 0 Then
Picture1.PSet (x, y), RGB(255 * Rnd, 255 * Rnd, 255 * Rnd)
#Else
SetPixel Picture1.hdc, x, y, RGB(255 * Rnd, 255 * Rnd, 255 * Rnd)
#End If
Next x
Next y
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
#If UtiliserAPI = 0 Then
Me.Caption = Hex$(Picture1.Point(x, y))
#Else
Me.Caption = Hex$(GetPixel(Picture1.hdc, x, y))
#End If
End Sub