Clear piece on the cross

Posted on 2007-03-19
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:



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:
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:

Any ideas? tks
Question by:adm_adamlee
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 17

Accepted Solution

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.

Author Comment

ID: 18753297
Looks a good idea, I will try that first.

Author Comment

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.
LVL 17

Expert Comment

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.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Internet Explorer View Settings Question 15 123
Delphi inherited method 6 80
TEMBEDDEDWB how can i change its user agent ? 8 84
IP without any Dots 1 58
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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…
In a recent question ( here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

749 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