Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maintaining layering of objects while moving around screen

Status
Not open for further replies.

DavenMoyra

Programmer
Feb 22, 2003
8
GB
Hi
I am trying to delop yet another card game based on solitaire. I have written a routine to manually drag a column of cards from 1 column to another. If I use an image control VB seems to maintain the layering OK but if I use the freeware cards.ocx depending on when the card was drawn the dragged cards will either go over other cards or underneath them. I have tried zorder 0 and auto redraw but with no luck. Has anyone else come across this
 
your problem may be the fact that you are using an image control, which is lightweight (windowless). try a picturebox or something with an hwnd as I think windowless controls always draw on the second of three layers available in vb.

lowest > print statements etc, ...
middle > lightweigth controls...
highest > heavyweight control like a picturebox

 
I tried this earlier but it creates a tricky problem. If the card.ocx is encapsulated within the picture box it takes the mouse down event but of course X and Y are given in relation to the picture box. The only information to give the position of the PB is its Left and Top at the time so the drag fails to move. I think I may have to bite the bullet and not use the ocx but to load the graphics from a resource file into a picture box myself.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top