1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| Dim i As Integer = 0
Dim x As Integer = 0
Dim y As Integer = 0
Dim b((Int(My.Computer.Screen.WorkingArea.Width / 100) + 1) * (Int(My.Computer.Screen.WorkingArea.Height / 100) + 1)) As Image
Dim g((Int(My.Computer.Screen.WorkingArea.Width / 100) + 1) * (Int(My.Computer.Screen.WorkingArea.Height / 100) + 1)) As Graphics
'J'ai donc pour changer géré la taille de mes tableaux dynamiquement, selon la résolution de l'utilisateur
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
b(i) = New Bitmap(My.Computer.Screen.WorkingArea.Width, My.Computer.Screen.WorkingArea.Height, Imaging.PixelFormat.Format16bppRgb555)
g(i) = Graphics.FromImage(b(i))
g(i).CopyFromScreen(New Point(x, y), New Point(x, y), New Size(100, 100))
Dim TempImg As New Bitmap(100, 100)
Dim TempGraph As Graphics = Graphics.FromImage(TempImg)
Dim rect As New Rectangle(0, 0, 100, 100)
TempGraph.DrawImage(b(i), rect, x, y, 100, 100, GraphicsUnit.Pixel)
b(i) = TempImg
'PictureBox1.Image = b(i)
If x < My.Computer.Screen.WorkingArea.Width - 100 Then
x += 100
Else
x = 0
y += 100
End If
If x >= My.Computer.Screen.WorkingArea.Width - 100 And y >= My.Computer.Screen.WorkingArea.Height - 100 Then
Timer1.Stop()
End If
i += 1
End Sub |
Partager