Ephesians
May 1st, 2002, 02:52 PM
Private Function Laser(picBild As PictureBox, StartX As Integer, StartY As Integer, StandLeft As Integer, StandRight As Integer, sFarbe As String)
Dim iZahl, iZahl2 As Integer
Dim sFarbe2 As String
Me.ScaleMode = vbPixels
With picBild
.ScaleMode = vbPixels
.AutoRedraw = True
End With
For iZahl2 = 0 To picBild.ScaleWidth
For iZahl = 0 To picBild.ScaleHeight
sFarbe2 = picBild.Point(iZahl2, iZahl)
Line (StartX, StartY)-(StandLeft + iZahl2, StandRight + iZahl), sFarbe2
Next
Line (StartX, StartY)-(StandLeft + iZahl2, StandRight + picBild.ScaleHeight), sFarbe
Next
For iZahl2 = 0 To picBild.ScaleHeight
Line (StartX, StartY)-(StandLeft + picBild.ScaleWidth, StandRight + iZahl2), sFarbe
Next
End Function
Private Sub Command1_Click()
Laser Picture1, 700, 500, Picture1.left, Picture1.Top, Me.BackColor
End Sub
Here's the problem:
The form opens and I click on the command button. The first time the function draws the picture, it draws it at co-ordinates 1200, 60 which is nowhere near the picture! Every subsequent push of the button draws it in the correct location which is 80,60. Why is it pulling this phantom co-ordinate from for the first run?
Dim iZahl, iZahl2 As Integer
Dim sFarbe2 As String
Me.ScaleMode = vbPixels
With picBild
.ScaleMode = vbPixels
.AutoRedraw = True
End With
For iZahl2 = 0 To picBild.ScaleWidth
For iZahl = 0 To picBild.ScaleHeight
sFarbe2 = picBild.Point(iZahl2, iZahl)
Line (StartX, StartY)-(StandLeft + iZahl2, StandRight + iZahl), sFarbe2
Next
Line (StartX, StartY)-(StandLeft + iZahl2, StandRight + picBild.ScaleHeight), sFarbe
Next
For iZahl2 = 0 To picBild.ScaleHeight
Line (StartX, StartY)-(StandLeft + picBild.ScaleWidth, StandRight + iZahl2), sFarbe
Next
End Function
Private Sub Command1_Click()
Laser Picture1, 700, 500, Picture1.left, Picture1.Top, Me.BackColor
End Sub
Here's the problem:
The form opens and I click on the command button. The first time the function draws the picture, it draws it at co-ordinates 1200, 60 which is nowhere near the picture! Every subsequent push of the button draws it in the correct location which is 80,60. Why is it pulling this phantom co-ordinate from for the first run?