Solved

Clear piece on the cross

Posted on 2007-03-19
4
224 Views
Last Modified: 2010-04-05
I'm making a Chinese chess program,  called XiangQi. the pieces are put on the crosses, not in square, this is different from internatinal chess... when dragging a piece to another cross, how to clear the old piece?

type cross used to define each crosses on the board:
type

 Cross=(None,A9,B9,C9,D9,E9,F9,G9,H9,I9,
                  A8,B8,C8,D8,E8,F8,G8,H8,I8,
                  A7,B7,C7,D7,E7,F7,G7,H7,I7,
                  A6,B6,C6,D6,E6,F6,G6,H6,I6,
                  A5,B5,C5,D5,E5,F5,G5,H5,I5,
                  A4,B4,C4,D4,E4,F4,G4,H4,I4,
                  A3,B3,C3,D3,E3,F3,G3,H3,I3,
                  A2,B2,C2,D2,E2,F2,G2,H2,I2,
                  A1,B1,C1,D1,E1,F1,G1,H1,I1,
                  A0,B0,C0,D0,E0,F0,G0,H0,I0);

....

I want to make a procedure like:
procedure ClearCross(cr: Cross);

to clear the old piece on the old cross, we can re-draw the background, but the problem is that not all the background are the same, see demo here: http://www.xerp.cn/cc/project1.exe
in this demo, when I drag a piece away, the background will be cleared, we need to draw something to make it look like the original look, see the blank board here: http://www.xerp.cn/cc/xqboard.bmp

Any ideas? tks
0
Comment
Question by:adm_adamlee
  • 2
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
TheRealLoki earned 500 total points
ID: 18746846
1 way would be to copy what is under the cross before you put the piece on it, then when you move the piece off, just repaint what you saved.
0
 
LVL 1

Author Comment

by:adm_adamlee
ID: 18753297
Looks a good idea, I will try that first.
0
 
LVL 1

Author Comment

by:adm_adamlee
ID: 18753538
before dragging a piece away, we can not copy the background under the piece, because it is overwritten, what you will copy is the piece itself.
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 18754274
What I am suggesting is you take a copy before any pieces are placed on teh board, that way, you have the true background of it kept.
another way would be to keep a copy of the entire board (but empty) in another bitmap, then just copy from that.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now