Dim I As Integer
DoGraphics = True
For I = 0 to 240 Step 20
MyRank = 0
MySuit = 3
MyX = I
MyY = 85
WarWindow.Refresh
MsgBox "Pause"
Next I
DoGraphics = False
What this code is going to do is put a bunch of aces of Spades all over
the window in a straight line.
The Ace of Spades _does_ appear in the proper place, But (surprise!)
overlapping it are the two cards on the left (the bottom one of which
has also changed to the Ace of Spades, but that's another topic) and
even under the printed words "Opponent won!" (or, as the case may be,
"Player won!").
Because you're stepping by 20, and the card widths themselves may be
more, might be the reason why you're getting some sort of overlap.
However, it sounds to me like you're confused about the order of
drawing. When you paint something directly on to the window (which is
essentially what's happening here), the operations can become "stacked"
based on the order you draw things. If you draw Card 1 and then draw
Card 2, the second operation will occlude the first one (assuming their
bounds overlap) because the first one is already painted onto the window
and the second one paints over it. The same concept is true for
controls -- they have a z-ordering just like paint operations do. So
what is probably happening is that you're painting the card, and then a
StaticText "paints" its Text over the card.
As you click repeatedly on the "OK" button on the MsgBox, the Ace of
Spades overlapped by the other two face-up cards moves cleanly to the
right, remaining _under_ both the other two cards and the printing, and
continues moving until it has completely passed also _under_ the stack
of cards on the right! There is no mess-up in the drawing (nothing
needs to be erased): it looks _exactly_ as if the one card were being
slid _under_ the other cards as it moves from left to right.
Because you're using MsgBox as a way to pause your application, you
cannot rely on anything you see. You're using MsgBox in the wrong way.
Try using App.SleepCurrentThread( 1000 ) for a 1-second pause instead.
HTH!
~Aaron
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|