Results 1 to 4 of 4

Thread: [RESOLVED] Biblt hide source help

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    259

    Resolved [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
    Attached Files Attached Files
    Last edited by seanwpb; Apr 1st, 2012 at 01:15 PM. Reason: typo

  2. #2
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Smile 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

  3. #3
    Addicted Member Witis's Avatar
    Join Date
    Jan 2011
    Location
    VB Forums Online Freedom Mode: Operational
    Posts
    213

    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).
    Attached Files Attached Files
    All men have an inherent right to life, the right to self determination including freedom from forced or compulsory labour, a right to hold opinions and the freedom of expression, and the right to a fair trial and freedom from torture. Be aware that these rights are universal and inalienable (cannot be given, taken or otherwise transferred or removed) although you do risk losing the aforementioned rights should you fail to uphold them e.g Charles Taylor; United Nations sources: http://www.un.org/en/documents/udhr/, http://www.ohchr.org/EN/Professional...ages/CCPR.aspx. Also Charles I was beheaded on the 30th of January of 1649 for trying to replace parliamentary democracy with an absolute monarchy, the same should happen to Dr Phil and Stephen Fry; source: http://www.vbforums.com/showthread.p...ute-Monarchism.

    The plural of sun is stars you Catholic turkeys.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    259

    Re: Biblt hide source help

    Witis,

    works perfect now. thanks again. your code was exactly what is needed.

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