Results 1 to 5 of 5

Thread: Erasing a line

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2006
    Posts
    21

    Question Erasing a line

    I am creating a screensaver that has a pictured displayed and then I have a black line drawn across 10 pixels wide that scrolls across and then down and across again. The result is a black screen. I then want to erase the live in the same fashion revealing the picture underneath. I can create the line but can not erase the line. I can create a new line and have a white screen but I want to erase. Any suggestions? Here is the code so far

    Private Sub Timer1_Timer()
    n = n + 1
    If n > 1 Then
    Line (1, 1)-(n, M), vbBlack, BF
    DrawWidth = 10
    n = n + 1
    M = M + 1
    End If
    If n > 1001 Then
    M = M + 10
    n = 1
    End If
    End Sub

  2. #2
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Erasing a line

    You're drawing in the Form? or in a PictureBox?
    If its the Form try: Me.Cls, If it is a Picturebox try PictureName.Cls

  3. #3
    Lively Member
    Join Date
    Jan 2006
    Location
    Louisbourg, NS
    Posts
    96

    Re: Erasing a line

    Quote Originally Posted by VB_Guy
    I am creating a screensaver that has a pictured displayed and then I have a black line drawn across 10 pixels wide that scrolls across and then down and across again. The result is a black screen. I then want to erase the live in the same fashion revealing the picture underneath. I can create the line but can not erase the line. I can create a new line and have a white screen but I want to erase. Any suggestions? Here is the code so far

    Private Sub Timer1_Timer()
    n = n + 1
    If n > 1 Then
    Line (1, 1)-(n, M), vbBlack, BF
    DrawWidth = 10
    n = n + 1
    M = M + 1
    End If
    If n > 1001 Then
    M = M + 10
    n = 1
    End If
    End Sub
    I'm still a VB newb but try making some code with -1 instead of always +1 not sure though
    Add yourself to the VBForums Frappr Map!!

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jan 2006
    Posts
    21

    Re: Erasing a line

    Quote Originally Posted by jcis
    You're drawing in the Form? or in a PictureBox?
    If its the Form try: Me.Cls, If it is a Picturebox try PictureName.Cls
    Yes this clears the screen as does Refresh. What I am trying to do is erase the black area in the same fashion as I created it. So undoing one pixel at a time.

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Erasing a line

    You would have to save the screen as an invisible picture the same size as the screen, and copy a section at a time from the original to the black screen. Once you erase the image, you cannot get it back. It has been altered by the black line.

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