home *** CD-ROM | disk | FTP | other *** search
- Form1
- QCard.DLL Demo
- Form1%
- Timer1
- Dra&wing
- DrawCard
- Draw&Card
- DealCard
- &DealCard
- DrawBack
- Draw&Back
- DrawSymbol
- Draw&Symbol
- RemoveCard
- &RemoveCard
- MenuExit
- E&xit
- Information
- &Information
- CardInformation
- &CardInformation
- Dragging
- &Dragging
- MenuDoDrag
- D&oDrag
- MenuHelp
- &Help
- m MenuHowTo
- Ho&w To...
- n MenuAbout
- A&bout
- Form_Click
- DealCard
- Form1
- Form_Loadi
- InitializeDecke
- Form_MouseDown
- Buttons
- Shift
- View_Click
- DealCard_Click
- DrawBack_Click(
- DrawBack~
- MenuExit_Click
- DrawSymbol_Click
- DrawSymbol
- EraseCard_Click
- DrawCard&
- Timer1
- EnabledE
- TRUEr
- Timer1_TimerA
- EraseCard
- FALSEC
- CARDWIDTHu
- CARDHEIGHT
- DrawCard_Click
- RemoveCard
- RemoveCard_Click.
- CardInformation_ClickY
- bDragging
- Form_MouseMove[
- Form_MouseUpq
- GetCardColorQ
- GetCardValue
- GetCardSuit
- GetCardX|
- GetCardY
- IsCardVisible
- Width2
- Height
- ScaleMode
- ScaleTop
- ScaleLeft
- Information_Click
- ScaleWidth
- ScaleHeight>
- bDragDemo
- SPACER
- MenuDoDrag_Click
- AdjustCardBlocked
- ActiveCard
- PointInCard
- nActiveCardH
- SetActiveCard
- InitDrag
- DoDrag)
- EndDrag
- OldY5
- Dragging_Click
- ReturnDrag
- PointInFreeCard
- Screen#
- MousePointer.
- InitDeck
- Form_Paint
- SetCardDisabled,
- Picture1
- nReturn
- PointInCardTop~
- Form_DblClick
- nClickedCard
- GlobalXf
- GlobalY
- DblClkX[
- DblClickX
- DblClickY
- nSpacer
- OFFSET
- BlockCardsf
- BlockDrag
- OffsetX
- OffsetY
- EndBlockDrag
- bSingleDraggingc
- bBlockDragging
- bBlockDrag
- SetDefaultValues
- ReturnBlockDragr
- DragCardsN
- Form2
- upperbound!
- lowerbound
- Lefte
- fresh
- GetFreeDestination
- GetCardBlocked
- nEndDrag
- nTemp
- AbortDrag
- nSourceCard
- nDestCard9
- CardArray
- Counter
- cxSpacer|
- SetUser3
- SetUser4
- nStatus
- nArrayID
- nArrayPos
- nItems'
- GetUser4
- GetUser3+
- nNewXD
- nNewY
- nSourceArrayV
- nSourceArrayPosq
- nDestArray
- nSourceColor
- nDestColor
- o_Click
- nSourceArrayID
- nDestArrayID
- nDeltaX
- nDeltaY
- nSourceX|
- nSourceY
- nUnused
- SetCardBlocked
- dlbClickY
- DlbClickX
- nThisSourceCard
- nThisDestCard
- bMouseMoved7
- process
- clicks
- similarR
- MenuHowTo_Click
- Helpn
- MenuAbout_Click
- About
- AutoRedraw
- nDrawSelection
- SelectCase
- nInformationCard
- DoText
- nCard
- MenuHelp_Click
- GetCardStatus
- SetCurrentBack
- SetCardStatus
- FACEDOWN
- FACEUP
- This program demonstrates some of the function callss
- of QCard.DLL. In an effort to keep all code under
- their respective Event Procedures, I have not usedd
- any Sub procedures of my own. Using a few Sub proceduress
- would considerably clean up the "spaghetti" nature of
- some of the dragging events.t
- This demo is not complete in that it does not repaint
- it's window properly. I was more interested in demonsrating
- function calls rather than creating a usable product.
- declare a few counters
- declare some test switchesn
- declare some card identifiers
- to save mouse position for double click event
- set up a two dimensional arrayy
- four arrays to hold the numbers of thee
- cards in each piled
- set up a counter to go along with each pile
- CardInformation_Click
- pick a random cardi
- pick a random locationt
- Int((upperbound - lowerbound + 1) * Rnd + lowerbound))
- set current information card for Paint eventt
- deal the card
- draw in the text informationr
- DealCard_Click
- deal cards in a diagonal line
- DoText
- Card number is
- Card color is
- Card value is
- Card suit is
- Card x location is
- Card y location is
- Card Status value is
- Form ScaleWidth is
- Form ScaleHeight is
- DrawBack_Click
- draw six piles of cards offsetting by 2 pixels up and overr
- DrawCard_Click
- draw the cards using DrawCard
- this does not update any of the propertiess
- of the cardst
- DrawSymbol_Click
- draw in one of each of the three symbolss
- Form_DblClick
- Only process DblClick in Drag Demo
- You can process double clicks in a similar
- way to the ButtonUp event.c
- The current mouse position is saved for us in the
- ButtonDown event as DblClickX and DblClickY
- Instead of using the Shared variables nSourceCard
- and nDestCard, we will use two local variabless
- nThisSourceCard and nThisDestCard..
- We need to do this because VB processes ButtonDownn
- and ButtonUp messages before it actually gets too
- the DblClick event. This will keep our currentt
- selections from being corrupted by one of the
- other eventsr
- We can use the PointInFreeCard function to determinee
- if the mouse is within any card that is not blocked
- pick a destination pile according to original pileE
- if this is the last card in a row, and not the only card in the row
- then move it over to the other "same color row" and adjust arrays and blocks
- Form_Load
- try to fire up the DLLL
- a FALSE return value indicates problems
- Sorry. Another application is using QCards.DLL
- set ScaleMode to Pixel(3) so form and DLL use the
- same coordinatess
- make form full screen width
- make some initial assigns
- Form_MouseDown
- InitDrag returns the number of the card that contains the
- mouse, as well as setting up the drag operation
- save mouse x and y position for double click eventt
- no card selecteds
- save old position for later use
- if the drag is invalidh
- if card is not blocked, it is a single drag
- if it's blocked, it means were doing a block drag
- Form_MouseMove
- if just a single card, it's number was set with InitDrag call
- determine which pile we are dealing withr
- determine the position of the first card in dragn
- how many cards are we movinge
- create an array to hold the numbers of the cards to movee
- and fill the array starting at 0e
- pass the BlockDrag sub the actual array, referencing it's
- first element. This acts as a "pointer" to the rest ofs
- the elements in the array in memory
- let the MouseUp event know that it is ok to
- reference the Temp(0) array for this instance
- Form_MouseUp
- most of the code here involves relocating cards
- to their new homes/arrays
- end the drag operation and
- find out who we are dropping in on
- do some color testing
- only allow drop if source and destination colors are the same
- and if nSourceCard is not the last card in it's pile.
- if nDestCard is 0, the Source Card was dropped at an invalid location
- if not a valid drop site, return drag
- valid single drag/drop... proceed with relocation
- which array did we come fromt
- reduce our old array countert
- which array are we joining
- add another to it's counter
- block our new neighbor
- install our new arrayID and positiong
- align with left side of card above us
- and down OFFSET (16)o
- unblock last card in old array
- add ourselves to new arrayr
- we can reuse the Temp() array from MouseMovee
- as long as MouseMove actually occurredc
- end the drag and find out the destination card
- do some color testing
- only allow drop if source and destination colors are the same
- and nSourceCard is not the last card in it's pile
- if not a valid drop site, return drag
- which array did we come from
- reduce our old array counter
- which array are we joining
- block our new neighbor
- this bit of code demonstrates how you can "fool" a drag operation
- to drag the item to a specific location. Usually, you pass the
- BlockDrag sub the x,y location of the mouse. If you first determine
- your current mouse position in relation to the object you are dragging
- you can add that difference (nDeltaX, nDeltaY) to the position youi
- want to drag to, and pass those points to BlockDrag. We want to align
- with the left side of DestCard and down OFFSET (16) pixels from its top
- install our new arrayIDs and positionsn
- unblock last card in old arrayy
- remove temporary block on last card in block drag array
- There was a MouseDown event but no MouseMove evente
- Form_Paint
- Even when the AutoRedraw property for yourr
- form is set to TRUE, VB will not redraw any
- of your cards for you. You must handle thee
- redrawing in the Paint Event. In a normal cardd
- game, your Paint Event will look a lot like
- Case 6 beloww
- MenuAbout_Click
- Form1.Refreshh
- MenuDoDrag_Click
- clear out any old card properties
- draw in symbols
- each pile has it's own array identifying the cardss
- each pile has a counter to maintain the pilee
- each card uses it's User3 and User4 properties to
- store which array it belongs to and what position
- it's in within the array. This makes dragging and
- dropping easier
- deal first pile and set up array
- card's position in array
- array ID
- block all cards except the one on top
- there are 13 cards per pile
- card's position in array
- array IDc
- card's position in array
- array IDc
- card's position in array
- array IDc
- MenuExit_Click
- MenuHowTo_Click
- winhelp.exe
- \qcard.hlp
- RemoveCard_Click
- deal 13 cards and enable the timer sub which will remove them
- Timer1_Timer
- remove cards one at a timee
- don't forget to take them off in reverse orderr
- or you will have a mess
-