-
[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?
-
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
-
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?
-
Re: Using bitblt and labels on form flash. Why is that and how do i stop it?
Quote:
Originally Posted by
Gamemaster1494
Could it be because i am using a timer?
It could be a lot of things - you just try elliminating one at the time...
-
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....
-
Re: Using bitblt and labels on form flash. Why is that and how do i stop it?
LOL, it's not the snippet I posted - rather what you do that interfers.
-
Re: Using bitblt and labels on form flash. Why is that and how do i stop it?
.... so... what should i do? xD
-
Re: Using bitblt and labels on form flash. Why is that and how do i stop it?
Don't use labels. Use .Print, or DrawText API.
-
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
-
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.
-
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...
-
Re: Using bitblt and labels on form flash. Why is that and how do i stop it?
Quote:
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
-
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?
-
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.
-
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....
-
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?
-
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...
-
Re: Using bitblt and labels on form flash. Why is that and how do i stop it?
Yea, you'll want to draw that text manually.
-
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...
-
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:
Me.CurrentX = Label1.Left
Me.CurrentY = Label1.Top
Me.Print "Hi"
'[B]OR[/B]
Form1.CurrentX = Label1.Left
Form1.CurrentY = Label1.Top
Form1.Print "Hi"
'Picturebox?
Picturebox1.CurrentX = Label1.Left
Picturebox1.CurrentY = Label1.Top
Picturebox1.Print "Hi"
Or something like:
vb Code:
Private Type tLabel
lX as Long
lY as Long
sCaption as String
bNewLine as Boolean
End Type
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.
-
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.
-
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