I’ve built software which animates a chess game showing the sliding movements of the pieces in a designated area of the main window. I use TPaintBox component for that purpose passing a TBitmap to TPaintBox.Canvas.Draw as a parameter.
Sometimes the picture freezes when I move the cursor during the animation process. The process in whole continues: the program reads the game move by move, but the image of the chess board doesn’t change. It seems TPaintBox loses the bitmap at that moment. I experimented a lot working on the function, which actually implements the process of drawing of the chess pieces movement on the board. Once I added a line, which had no direct relation to the animation and merely wrote the move information to a TMemo, such as move number, etc. And miraculously the picture stopped freezing! Later I redesigned the program interface and that TMemo became no longer useful. But I’ve left it, setting its Visible property to False, because it somehow helps to avoid the freezing of animation!
Not that that TMemo bothers me much, but in general I don’t like useless code and I want to understand the nature of the problem. I suspect that there might be a problem with Windows GDI resources (I use Windows XP).
Sometimes the picture freezes when I move the cursor during the animation process. The process in whole continues: the program reads the game move by move, but the image of the chess board doesn’t change. It seems TPaintBox loses the bitmap at that moment. I experimented a lot working on the function, which actually implements the process of drawing of the chess pieces movement on the board. Once I added a line, which had no direct relation to the animation and merely wrote the move information to a TMemo, such as move number, etc. And miraculously the picture stopped freezing! Later I redesigned the program interface and that TMemo became no longer useful. But I’ve left it, setting its Visible property to False, because it somehow helps to avoid the freezing of animation!
Not that that TMemo bothers me much, but in general I don’t like useless code and I want to understand the nature of the problem. I suspect that there might be a problem with Windows GDI resources (I use Windows XP).