Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Horizontal scroller...


Reply
 
Thread Tools Display Modes
  #1  
Old 07-13-2003, 09:35 PM
alvifarooq alvifarooq is offline
Junior Contributor
 
Join Date: Mar 2003
Posts: 205
Default Horizontal scroller...


hi guys...

i am trying to implement this horizontal scroller (marquee) on my form...this is the code i have used so far and well the marquee runs with a glitch...it disappears when in the middle of the picturebox...could u suggest something...

the following code is placed within a timer with an interval of 100 ms...also the label lblMarquee is placed inside the picturebox picMarqueeBack

'------------------
if (lblMarquee.left + lblMarquee.width) <= picMarqueeBack.left Then
lblMarquee.left = picMarqueeBack.left + picMarqueeBack.Width
end if

lblMarquee.left = lblMarquee.left - 50

lblMarquee.autosize = true
'------------------

also this kind marquee is not very smooth...it has a lot of breaks in it...can you suggest some other way of doing the same thing...api calls?

Regards,

Farooq
Reply With Quote
  #2  
Old 07-14-2003, 02:35 AM
DrPunk's Avatar
DrPunk DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,285
Default

Your problem is that your label is "contained" within the picturebox. Therefore, the coordinates of the label are taken from the picturebox (i.e. the coordinate 0,0 of the label is the top left of the picturebox).

You are comparing the position of the label with the position of the picturebox, but the pictureboxes coordinates are taken from the form (i.e. the coordinate 0,0 of the picturebox is the top left of the form).

Therefore, the test
Code:
if (lblMarquee.left + lblMarquee.width) <= picMarqueeBack.left Then
will depend on the position of the picturebox in accordance with the form. If you move the picturebox further right in the form, the label will move even less to the left.

Because the label is contained within the picturebox, you can just use 0 to find out when the label has moved out of the pictureboxes viewing area.
Code:
if (lblMarquee.left + lblMarquee.width) <= 0 Then
That should let it scroll all the way across the picturebox.

As far as taking this project further, to try and cut out the flashing, you'll need to get into back buffering, and blitting. There's tons of stuff about this in this forum, with some great examples (check out the Interface and Graphics forum for more info). In a simple form, this would involve two pictureboxes. One hidden (the back buffer) and one visible (the view). You draw to the back buffer which is hidden, and then use the BitBlt API to copy the back buffer picturebox into the view. You can also do away with the back buffer picturebox, and manipulate memory directly, but when using text the Pictureboxes Print method is useful.
__________________
There are no computers in heaven!
Reply With Quote
  #3  
Old 07-15-2003, 09:20 PM
alvifarooq alvifarooq is offline
Junior Contributor
 
Join Date: Mar 2003
Posts: 205
Default

hey thanks a lot...

i've made the change...now the only problem is that after it moves out on the left side...it comes out from the right side after a considerable amount of time...that's weird...

I am not gonna go for the bilting thing cause this is for a relatively low-end function in the main program...so it's ok i guess...

Thanks a lot...

Farooq
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vertical Scroller and Horizontal Scroller Silv3rSurf3r_20 API 1 04-14-2003 12:47 PM
Graphic method for scroller shmoove Game Programming 3 10-09-2002 12:56 PM
Is it possible to remove a horizontal scrollbar from a listview? jabroni5508 General 1 04-24-2002 04:23 AM
Horizontal scrolling on FileListBox? (or lack of) MoMo General 3 02-23-2002 05:46 PM
horizontal scrollbar bartvb General 3 10-08-2001 07:13 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->