|
-
Oct 14th, 2001, 11:20 PM
#1
Thread Starter
Fanatic Member
transparency problem....
Hey, I'm going to have scrolling text on top of a textured image in my program, so the area where the text is needs to be transparent so you can see through to image. Here's the problem:
Using the worthless (for scrolling anyway) label control, I get tons of flickering. Someone suggested I use a picture box, but here's the problem with that: If I put the same image as the background image in the picture box, then the patterns don't match up at all (remember, it's a textured image!). And, I didn't see anywhere to set a picturebox background to transparent. Sooo, my question is: What kind of control do I need to use to accomplish this? Is there an activeX control I can d/l to do this? I'd like to stay away from directx as someone before mentioned that would be overkill for my purposes. Any help is appreciated.
-
Oct 15th, 2001, 02:47 AM
#2
Fanatic Member
Is the image tiled or not? How is the text scrolled, just from right to left again and again, is it bouncing, etcetera....
(just trying to collect some info before I start writing code )
Teaudirenopossum.Musasapientumfixaestinaure.
(I can't hear you. There's a banana in my ear)
-
Oct 16th, 2001, 12:08 AM
#3
Thread Starter
Fanatic Member
It's like this!
text just scrolls from left to right, and, no, the image is not tiled. Thanks for any help you can give.
-
Oct 16th, 2001, 06:04 AM
#4
Fanatic Member
(hopefully the next piece of code is bug-free, no VB here, sorry)
Drop a picturebox on your form.
Name: picBackground
Picture: Your background image
AutoSize: True
AutoRedraw: True
ScaleMode: vbPixels
Font: Whatever font you want to use
Also drop a timer on your form:
Name: tmrScroll
Interval: 100 (experiment with this, unfortunately, the timer practically won't go lower than 50, or 10 on Windows NT)
Enabled: True
In the General -> Declarations of your form:
VB Code:
Private lXPos As Long
Private Message As String
Form_Load:
VB Code:
Sub Form_Load()
lXPos = picBackground.ScaleWidth
Message = "Ain't that cute!"
End Sub
tmrScroll_Timer:
VB Code:
Sub tmrScroll_Timer()
' Move text (change -1 for faster movement)
lXPos = lXPos - 1
If lXPos < picBackground.TextWidth(Message) Then lXPos = picBackground.ScaleWidth
' Clear the picturebox
picBackground.Cls
' Draw the text
picBackground.CurrentX = lXPos
picBackground.CurrentY = (picBackground.ScaleHeight - picBackground.TextHeight(Message)) / 2
picBackground.Print(Message)
' Display changes
picBackground.Refresh
End Sub
Now that's the non-API way, you could also replace CurrentX, CurrentY and Print with the TextOut API, but I don't know the declaration, and this should also work theoretically 
Note that when you are going to use the API, ScaleMode has to be Pixels, so just in case I already let you set it 
Hope that helps...
Teaudirenopossum.Musasapientumfixaestinaure.
(I can't hear you. There's a banana in my ear)
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
|