Re: Scrolling text in a stationary label help needed
- From: jcrouse1@xxxxxxxxxxx
- Date: 20 Sep 2006 10:32:45 -0700
Mike,
Here is the code I settled on. I am not sure whay the example scrolls
so slowly but in my app it works perfectly, VERY nice. Now I have to
figure out how to do this for a possible maximum of 5 labels (picture
boxes) if the caption width exceeds the label width. Does a loop in the
time sound like the correct approach?
Option Explicit
Dim objDX As New DirectX7
Dim objDD As DirectDraw7
Dim wide As Long
Dim xposition As Long
Dim strScrollingGameName As String
Private Sub Form_Load()
Set objDD = objDX.DirectDrawCreate("")
' Me.Picture = LoadPicture("c:\tulips.jpg")
strScrollingGameName = "This is my scrolling text."
Timer1.Interval = 10
End Sub
Private Sub Timer1_Timer()
ScrollText Label1.Left, Label1.Top, Label1.Width, Label1.Height
End Sub
Private Sub ScrollText(x As Long, y As Long, picwide As Long, pichigh
As Long)
Dim wide As Long
Dim xposition As Long
If Picture1.TextWidth(strScrollingGameName) > Label1.Width Then
Picture1.Top = Label1.Top
Picture1.Left = Label1.Left
Picture1.Height = Label1.Height
Picture1.Width = Label1.Width
Picture1.FontName = Label1.FontName
Picture1.FontSize = Label1.FontSize
If Label1.FontBold = True Then
Picture1.FontBold = True
Else
Picture1.FontBold = False
End If
If Label1.FontItalic = True Then
Picture1.FontItalic = True
Else
Picture1.FontItalic = False
End If
Picture1.Visible = True
Label1.Visible = False
Picture1.Cls
wide = Picture1.TextWidth(strScrollingGameName)
Picture1.Move x, y, picwide, pichigh
DoEvents
' Picture1.PaintPicture Me.Picture, 0, 0, picwide, pichigh, x,
y, picwide, pichigh
' Picture1.Picture = Picture1.Image
Do
For xposition = picwide To -wide Step -1
Picture1.Cls
Picture1.CurrentX = xposition
Picture1.Print strScrollingGameName;
objDD.WaitForVerticalBlank DDWAITVB_BLOCKBEGIN, ByVal 0
DoEvents
Next xposition
Loop
End If
End Sub
Thanks,
John
jcrouse1@xxxxxxxxxxx wrote:
I'll start with a quick apology. I COMPLETELY overlooked your one post,
the one that was most relivent. Your two posts in a row caused me to
overlook the first one. I am just using a web browser and Google Groups
which isn't the best method for posting and reading. Anyways, I am
making good progress, thanks to you. I will get a handle on where I am
and post my code and an explination of where I am at in more detail
after i finish reading and studying your examples in greater detail. I
am sure what I need is there I just need to modify a few location
issues.
Thanks again,
John
Mike Williams wrote:
<jcrouse1@xxxxxxxxxxx> wrote in message
news:1158753139.398359.115790@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Mike, Thanks a lot for your time on this. It really is appreciated.
Anyways, the above code doesn't work for me.
Which "above code" doesn't work? Do you mean the last example I posted? If
so, then what, exactly, "doesn't work" about it? What error message are you
getting, or what is not happening that you think should happen? It works
fine at this end, and I cannot see any reason why it should not also work on
your system. Have you definitely set a reference to the DirextX7 type
library (Project / References)? And is your Form large enough so that you
can actually see the scrolling text? (In the demo code I've positioned it at
location (100, 200) pixels). Also, have you changed the hard coded picture
path to point to a picture that is present on your own system? All sorts of
things could be wrong. Simply saying "it doesn't work for me" doesn't tell
me anything!
Anyways, any idea on my transparency issue in my last post.
It is why I was attempting to use a label in the first place.
At this point I've got to ask, "Have you actually read my messages!" Have
you in particular actually read the first of the three messages which I
posted today (not counting this one)? It starts of with an extract from your
question when you said, "However, there is no way to make the picturebox
transparent" and my reply is, "Yes there is.". Have you read *all* of that
message, in which I explain in great detail how to achieve the
"transparency" you are after, and have you actually tried the code I
included at the end of that message which does exactly what you are after
(text scrolling with a transparent background over a Form's picture). I
don't want to sound harsh John, but if you're not going to read my messages
(all of them!) and if you're not going to take the time to include some
detail in your responses then maybe I'm wasting my time writing them?
Please read in detail ***all of the messages*** I posted in this thread and
please try ***all of the code samples*** they contain (lots of different
examples). Then, when you have done all that, post back and tell me
*exactly* what happens on your system.
Mike
.
- Follow-Ups:
- Re: Scrolling text in a stationary label help needed
- From: Mike Williams
- Re: Scrolling text in a stationary label help needed
- References:
- Scrolling text in a stationary label help needed
- From: jcrouse1
- Re: Scrolling text in a stationary label help needed
- From: Dmitriy Antonov
- Re: Scrolling text in a stationary label help needed
- From: jcrouse1
- Re: Scrolling text in a stationary label help needed
- From: Dmitriy Antonov
- Re: Scrolling text in a stationary label help needed
- From: Mike and Maureen
- Re: Scrolling text in a stationary label help needed
- From: Mike Williams
- Re: Scrolling text in a stationary label help needed
- From: jcrouse1
- Re: Scrolling text in a stationary label help needed
- From: jcrouse1
- Re: Scrolling text in a stationary label help needed
- From: jcrouse1
- Re: Scrolling text in a stationary label help needed
- From: jcrouse1
- Re: Scrolling text in a stationary label help needed
- From: Mike Williams
- Re: Scrolling text in a stationary label help needed
- From: jcrouse1
- Re: Scrolling text in a stationary label help needed
- From: Mike Williams
- Re: Scrolling text in a stationary label help needed
- From: jcrouse1
- Scrolling text in a stationary label help needed
- Prev by Date: Re: File exists
- Next by Date: Re: Adding Code to a Command Button Added At Run Time
- Previous by thread: Re: Scrolling text in a stationary label help needed
- Next by thread: Re: Scrolling text in a stationary label help needed
- Index(es):
Relevant Pages
|