Results 1 to 6 of 6

Thread: Alright, who's gonna ge this one?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    424

    Alright, who's gonna ge this one?

    VB Code:
    1. Private Function Laser(picBild As PictureBox, StartX As Integer, StartY As Integer, StandLeft As Integer, StandRight As Integer, sFarbe As String)
    2.  
    3. Dim iZahl, iZahl2 As Integer
    4. Dim sFarbe2 As String
    5.  
    6. Me.ScaleMode = vbPixels
    7.  
    8. With picBild
    9. .ScaleMode = vbPixels
    10. .AutoRedraw = True
    11. End With
    12.  
    13. For iZahl2 = 0 To picBild.ScaleWidth
    14. For iZahl = 0 To picBild.ScaleHeight
    15. sFarbe2 = picBild.Point(iZahl2, iZahl)
    16. Line (StartX, StartY)-(StandLeft + iZahl2, StandRight + iZahl), sFarbe2
    17.  
    18. Next
    19. Line (StartX, StartY)-(StandLeft + iZahl2, StandRight + picBild.ScaleHeight), sFarbe
    20. Next
    21.  
    22. For iZahl2 = 0 To picBild.ScaleHeight
    23. Line (StartX, StartY)-(StandLeft + picBild.ScaleWidth, StandRight + iZahl2), sFarbe
    24. Next
    25.  
    26. End Function
    27.  
    28.  
    29. Private Sub Command1_Click()
    30. Laser Picture1, 700, 500, Picture1.left, Picture1.Top, Me.BackColor
    31.  
    32. 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?

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    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...

  3. #3
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    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.


  4. #4
    Fanatic Member McCain's Avatar
    Join Date
    Jan 2002
    Location
    Sweden/Denmark
    Posts
    802
    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

  5. #5
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Or Switzerlad Hoi!

    Well this would be better done using the LineTo API (way faster) ... however, you can make cool menus like this if you just move the lines along the borders (or "burn" the letters with lasers )

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    424
    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
  •  



Click Here to Expand Forum to Full Width