|
-
Jan 7th, 2006, 06:11 PM
#1
Thread Starter
Junior Member
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
-
Jan 7th, 2006, 06:23 PM
#2
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
-
Jan 7th, 2006, 06:24 PM
#3
Lively Member
Re: Erasing a line
 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!!
-
Jan 7th, 2006, 07:30 PM
#4
Thread Starter
Junior Member
Re: Erasing a line
 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.
-
Jan 7th, 2006, 07:34 PM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|