Results 1 to 22 of 22

Thread: [RESOLVED] Using bitblt and labels on form flash. Why is that and how do i stop it?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Resolved [RESOLVED] Using bitblt and labels on form flash. Why is that and how do i stop it?

    Im using bitblt on a form. the bitblt works just fine. But, the labels i am using flash sometimes... how can i stop this?
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    It may happen when window gets refreshed/redrawn - try using LockWindowUpdate api function:
    Code:
    Option Explicit
    
    Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
    
    
    'somewhere in your code
    
    LockWindowUpdate Me.hWnd
    
    'your main code goes here
    
    LockWindowUpdate False

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    do i put the LockWindowUpdate Me.hWnd before i do the bitblt? and then the LockWindowUpdate False after its done? i did that, and i put it at the total end and beginning of the code, and it doesnt work.....

    Could it be because i am using a timer?
    Last edited by Gamemaster1494; May 25th, 2010 at 07:31 PM.
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  4. #4

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    well, the code you gave me didnt work....
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  6. #6

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    .... so... what should i do? xD
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  8. #8

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    .... Can they click on that? And, how would i use it to replace the lables? =P
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  10. #10
    Fanatic Member FireXtol's Avatar
    Join Date
    Apr 2010
    Posts
    874

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    You can keep the label there as a fully transparent area if you like....

    In which case you can also use the label's position to draw the text.

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    Yeah. I have it transparent... How do i draw the text where the labels position would be? All i know is
    Print "Hi"

    No idea on how to make it a certain position...
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  12. #12
    Hyperactive Member
    Join Date
    Sep 2009
    Location
    Lost in thought
    Posts
    349

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    How do i draw the text where the labels position would be?
    draw the text to the labels position
    Code:
    label.Left
    label.Top
    label.Width 
    label.Height

  13. #13

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    Okay.... But how would i set it up?

    Print "Hi", 31, 31, 40, 38

    ? how?
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  14. #14
    Fanatic Member FireXtol's Avatar
    Join Date
    Apr 2010
    Posts
    874

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    .CurrentX = Label1.Left
    .CurrentY = Label1.Top
    .Print "Hi"

    WordWrap would need multiple calls to Print, or a single call to DrawText with the DT_WordBreak const/flag.

  15. #15

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    Okay... I am totaly confused... do i do
    With Wordwrap
    .CurrentX = 10
    .CurrentY = 10
    .Print "Hi"
    End With

    to print it?

    Okay. Instead, is there another thing that will stop the label from flashing? Because i would have to go threw all of the code i already have with the labels....
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  16. #16
    Fanatic Member FireXtol's Avatar
    Join Date
    Apr 2010
    Posts
    874

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    Wordwrap is a property on a label.... That enables or disables wordwrap. Wordwrap is where it wraps text(words) onto a new line. It's not a control. It's not an object.

    CurrentX and CurrentY are properties on a form, and picturebox. Print is also a method for form's, and picturebox's.

    When do they flash? Regardless, have you tried setting their container's(again picturebox's or form's) AutoRedraw to True?

  17. #17

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    Yeah. All autoredraw = true...i have the background of the form(using bitblt vbSrcCopy) moving. every so often, all the lables start flashing. not all at once. Different ones at different times...
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  18. #18

  19. #19

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    ....XD I am so sorry. I must be tired or something... I have no idea what you mean. Is there some sample you can give me? It would really help.

    All i know how to do is

    Print text1.text
    Print text2.text

    and it does it one line after the other... no specific area, or width, height, etc...
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  20. #20
    Fanatic Member FireXtol's Avatar
    Join Date
    Apr 2010
    Posts
    874

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    You're printing on a form?

    vb Code:
    1. Me.CurrentX = Label1.Left
    2. Me.CurrentY = Label1.Top
    3. Me.Print "Hi"
    4.  
    5. '[B]OR[/B]
    6.  
    7. Form1.CurrentX = Label1.Left
    8. Form1.CurrentY = Label1.Top
    9. Form1.Print "Hi"
    10.  
    11. 'Picturebox?
    12.  
    13. Picturebox1.CurrentX = Label1.Left
    14. Picturebox1.CurrentY = Label1.Top
    15. Picturebox1.Print "Hi"

    Or something like:
    vb Code:
    1. Private Type tLabel
    2.   lX as Long
    3.   lY as Long
    4.   sCaption as String
    5.   bNewLine as Boolean
    6. End Type
    7.  
    8. Private myLabels() as tLabel

    bNewLine could enable an optional check to split the sCaption on vbCrLf or vbNewline, or similar, and to print multiple lines. DrawText API can use a set width, and wrap automagically.

    Further more, TextWidth and TextHeight (both of these functions are members of Form and PictureBox) will return metrics for a string passed to them.

  21. #21

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    Oh.... xD i didnt know there was a currentx and currenty of the form. XD thanks. Ill try it out.
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  22. #22

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: Using bitblt and labels on form flash. Why is that and how do i stop it?

    Yeah. It worked Perfectly. Took a bit of adjustment. But it worked. Thanks so much! =D
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

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