1 Attachment(s)
[RESOLVED] Biblt hide source help
i have the attached form that im working on that has two picture boxes that the first one has a scrolling ticker type label in it and it is copied to the bottom picture box with Bitblt. im doing this cause the label flickers. my problem is now i want to hide the picture box with the label, but when i do it doesn't show in the destination picture box. i have tried changing the autodraw to true and it only works with false. i have also messed around with drawing to the original picture box but then its just a mess. im not using bitblt correct and this is my first attempt. any help would be great
Re: Biblt hide source help
please it is much better if you post the code in code Tags .
Code:
Option Explicit
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Const SRCCOPY = &HCC0020
Dim blLabelONEIsVisible As Boolean
Dim blLabelTWOIsVisible As Boolean
Private Sub Form_Load()
blLabelONEIsVisible = True
blLabelTWOIsVisible = False
Label2.Visible = False
Label2.Caption = "label2 this is label two and im testing this"
Label3.Caption = "label3 this is label two and im testing this"
End Sub
Private Sub Timer1_Timer()
'Label3.Move Label3.Left - 20 ' move the label to the left for scrolling effect
Text1 = Label2.Left
' If label3.Left < -label3.Width Then
' label3.Left = Picture1.Width
' End If
If blLabelONEIsVisible = True Then
Label3.Move Label3.Left - 20
If Label3.Left < -(Label3.Width / 2) Then
Text1 = Label2.Left
Label2.Visible = True
If blLabelTWOIsVisible = False Then
blLabelTWOIsVisible = True
Label2.Left = Picture1.Width - 400
End If
If Label3.Left < -Label3.Width Then
blLabelONEIsVisible = False
End If
End If
End If
If blLabelTWOIsVisible = True Then
Label2.Move Label2.Left - 20
If Label2.Left < -(Label2.Width / 2) Then
If blLabelONEIsVisible = False Then
blLabelONEIsVisible = True
Label3.Left = Picture1.Width - 400
End If
If Label2.Left < -Label2.Width Then
blLabelTWOIsVisible = False
End If
End If
End If
'Me.Picture1.CurrentY = Me.Label3.Top ' use the label coordinates to set printing position
'Me.Picture1.CurrentX = Me.Label3.Left ' use the label coordinates to set the printing position
'Me.Picture1.Print Me.Label3 ' print the label text on to the picture box
'Picture2.Cls ' clear the destination picbox
BitBlt Picture2.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, Picture1.hDC, 0, 0, SRCCOPY ' bitblt picture1 to picture2 to remove flicker
End Sub
1 Attachment(s)
Re: Biblt hide source help
you are on the right track, playing around with the auto redraw and printing directly onto the picture box is the way to solve your problem.
actually I found that printing directly to the picture box seems to get rid of the flicker instead of using a label, although in case it doesn't I have included BitBlt too. see attached (resize the form to see that hiding the first picture box doesn't cause a problem).
Re: Biblt hide source help
Witis,
works perfect now. thanks again. your code was exactly what is needed.