Re: Scrolling text in a stationary label help needed



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

.



Relevant Pages

  • Re: Scrolling text in a stationary label help needed
    ... Dim xposition As Long ... Dim stext As String ... Private Sub Form_KeyPress ...
    (microsoft.public.vb.general.discussion)
  • Form_Current event not functioning quite correctly
    ... Private Sub Form_Current ... Dim strPosition As String ' Define Variables ... The code works great when scrolling from record to ...
    (microsoft.public.access.formscoding)
  • RE: What to use for floating help?
    ... worksheet) and therefore is not affected by scrolling. ... Private Sub MakeCodeDescripTB() ... Dim btn As CommandBarButton ...
    (microsoft.public.excel.programming)
  • Re: scrolling in textbox Options
    ... turn of 'smooth' scrolling ... Private Const EM_GETFIRSTVISIBLELINE = &HCE ... Private Sub GetCaretPos(ByVal txt As TextBox, ByRef Row As Long, ByRef Col ... Dim iFirstCharInCurrentLine As Long ' 0 Based ...
    (microsoft.public.vb.general.discussion)
  • Re: Modules not Known
    ... Dim pCode$ ... Dim pCodeModule As CodeModule ... Private Sub VBIDEReference() ... Option Compare Database ...
    (comp.databases.ms-access)