|
-
May 1st, 2002, 02:52 PM
#1
Thread Starter
Hyperactive Member
Alright, who's gonna ge this one?
VB Code:
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?
-
May 1st, 2002, 03:41 PM
#2
PowerPoster
This sounds like a unit conversion problem..
I'm right, put the Scalemode of your form and picture to 3 in design mode, it'll work just fine. If you want to do it by code put the unit changing in Form_Load or something...
-
May 1st, 2002, 03:47 PM
#3
Not NoteMe
Nice effect BTW
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
May 1st, 2002, 09:59 PM
#4
Fanatic Member
Looks like a guy (or girl) from Germany... =)
Wie geht's?
If you don't mind me asking, what do you use this cool effect for?
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
May 2nd, 2002, 04:29 AM
#5
-
May 2nd, 2002, 11:40 AM
#6
Thread Starter
Hyperactive Member
The problem with using the LineTo api is that the last pixel of the line is always blank. Therefore the picture erases itself as it draws. I tried to use that api and couldn't seem to get it to work.
If you can figure out how to use the lineto api for that could I would appreciate seeing it. I didn't create the code by the way, I just got it off vbcode.com.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|