Animation Problem VB6
Animation Problem VB6
Animation Problem VB6
Animation Problem VB6
Animation Problem VB6
Animation Problem VB6 Animation Problem VB6 Animation Problem VB6 Animation Problem VB6 Animation Problem VB6 Animation Problem VB6 Animation Problem VB6 Animation Problem VB6
Animation Problem VB6 Animation Problem VB6
Animation Problem VB6
Go Back  Xtreme Visual Basic Talk > > > Animation Problem VB6


Reply
 
Thread Tools Display Modes
  #1  
Old 02-28-2015, 02:56 PM
Hustey Hustey is offline
Newcomer
 
Join Date: Jan 2015
Posts: 2
Default Animation Problem VB6


Hi there,

I've done a bit of programming in vb6 before, but never tried to make any animations - I have never used images and timers before.

I've been trying to make a program which pushes a verticle red line horizontally across the form until it reaches the end of the form - when it reaches the end of the form it starts at the beginning of the form again.

I know that the .width of the form is different to the .scalewidth of the form. But I don't know how to find out the visible width of the form (I.E the width of the white part of the form if the background of the form is white). As the .scalewidth of the form seems to be greater than the .width of the form. I need to know the width of the inner section as my line needs to be reset when it reaches this width value.

Thanks for your time.

-Hustey
Reply With Quote
  #2  
Old 03-01-2015, 03:42 AM
hDC_0Animation Problem VB6 hDC_0 is offline
Contributor

* Expert *
 
Join Date: Feb 2004
Posts: 559
Default Line = Line Control?

Are you using a Line control or are you drawing the lines?

If you are using the Line control and are worried about scaling,
the working controls resizing example attached to this vbHelper page may be of help.

I makes special mention of the fact:
Quote:
Notice how the code handles Line controls specially because they have X1, Y1, X2, and Y2 properties instead of the usual Left, Top, Width, and Height properties.

Quote:
Originally Posted by Hustey
I've done a bit of programming in vb6 before, but never tried to make any animations - I have never used images and timers before.
If you haven't worked much with timers, this vbHelper page also has an example of rotating Line controls using a Timer.

And although the Line control is a lightweight control (that lacks many of the mouse events and Move method associated with other controls),
you can still detect when a mouse moves over it using the code example attached to this page.

..and since I'm one of the really old timers on the forum,
I know of this very old classic VB app called the "Screen Blanker Demo",
or it's sometimes just called the "Blanker app" as on this MSDN page.

It was actually several demos rolled up into one.
The "Jumpy Line" code part of the demo (which uses the Timer control),
might be useful to take a glance at..

Here is the list of files need.
But it's no longer available for download from Microsoft.
However you might find the files elsewhere if you look around.

If you drawing the lines, you will either have to:
1.) Draw on a control (like the picturebox control) and use the controls properties to keep track of it's movement (including dragging).
OR
2.) Draw on the form directly, and use some kind of tracking to figure out where/when to redraw the line based on mouse movements
(which could even mean using the advanced technique of bitblt-ing from a memDC).

Last edited by hDC_0; 03-01-2015 at 04:08 AM.
Reply With Quote
  #3  
Old 03-01-2015, 10:24 AM
Hustey Hustey is offline
Newcomer
 
Join Date: Jan 2015
Posts: 2
Default

I'm just getting slightly confused between the form.width and the form.scalewidth properties. If I set my form.width property to 10000, my form.scalewidth shows up as 12353 which is greater than the form.width value. But I thought that form.scalewidth represented the width of the inner part of the form?
Reply With Quote
  #4  
Old 03-02-2015, 11:10 AM
passel's Avatar
passelAnimation Problem VB6 passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,026
Default

For drawing, I prefer to set the ScaleMode to Pixels, so I know how many pixels I have to work with, since you can't draw smaller than a pixel. It also helps to smooth out motion since you know whether your drawing will move or not. When the scale exceeds the number of pixels, the drawing has to align with the nearest pixels, so some lines may pick the pixels on one side, and others on the other side of the coordinate.
When drawing a grid of lines, this can show up with uneven cells as the lines are drawn at a give coordinate +/- one pixel.
And if you move a grid, you can get "swimming" lines, as various lines have to alias themselves to one pixel of the other.

The default scalemode is Twips, which is related to a logical inch, and how many twips it takes to make a pixel varies depending on how many the dots per inch (DPI) setting of windows.
Since the number of TwipsPerPixel can vary, (two common values used to be 12 twips per inch, or 15 twips per inch), I prefer pixels.
And if you end up using API calls, they also expect all coordinates to be in pixels.

It sounds like you might have tried to change one of the scale properties, e.g. ScaleLeft, ScaleTop, ScaleWidth, which changes the Scalemode to User. At that time, the ScaleWidth may have tried to adapt and became a scale that was actually a little finer than Twips, lets call it USPP (UserScalePerPixel).
So, perhaps your Twips setting could be 12 and your USPP is around 15.

The "outer" scale, i.e. the size of the form will always be in Twips, you can't change that.
But the "inner" scale is changable and you can zoom your drawing in and out just by changing the ScaleWidth and Height and redoing the same drawing.

So, your internal (client area) scaleWidth can be any value within the range of a single, but you have to be careful with drawing because I believe if the drawing tries to exceed 32K physical pixels in width, you will get an error.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
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

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
Animation Problem VB6
Animation Problem VB6
Animation Problem VB6 Animation Problem VB6
Animation Problem VB6
Animation Problem VB6
Animation Problem VB6 Animation Problem VB6 Animation Problem VB6 Animation Problem VB6 Animation Problem VB6 Animation Problem VB6 Animation Problem VB6
Animation Problem VB6
Animation Problem VB6
 
Animation Problem VB6
Animation Problem VB6
 
-->