Private Sub Command1_Click() Dim a as integer Dim x,y as Long Picture1.DrawStyle = 0 For a = 0 To 10 x = Picture1.Width * Rnd * Screen.TwipsPerPixelX y = Picture1.Height * Rnd * Screen.TwipsPerPixelY Picture1.DrawWidth = 4 Picture1.Line (0, 0)-(x, y), vbBlue Picture1.DrawWidth = 2 Picture1.Line (0, 0)-(x, y), vbRed Next End Sub
Private Sub Form_Load() Picture1.AutoRedraw = True End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Picture2.Visible = False End Sub Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim a as integer Picture2.Visible = True Picture2.Cls Picture2.DrawWidth = 1 Picture2.PSet (170, 70), Picture2.BackColor Picture2.Print "Image !!!" For a = 1 To 2 Picture2.DrawWidth = 4 / a Picture2.Line (50, 50)-(Picture2.Width - 50, 50), IIf(a = 1, vbBlue, 0) + IIf(a = 2, vbYellow, 0) Picture2.Line -(Picture2.Width - 50, Picture2.Height - 50), IIf(a = 1, vbBlue, 0) + IIf(a = 2, vbYellow, 0) Picture2.Line -(50, Picture2.Height - 50), IIf(a = 1, vbBlue, 0) + IIf(a = 2, vbYellow, 0) Picture2.Line -(50, 50), IIf(a = 1, vbBlue, 0) + IIf(a = 2, vbYellow, 0) Next a Picture2.Move X + Picture1.Left, Y + Picture1.Top End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question