调用Windows中的Cards.dll的函数cdtdraw画出来的扑克牌如何擦除掉啊?(50分)

  • 主题发起人 主题发起人 lixin38
  • 开始时间 开始时间
L

lixin38

Unregistered / Unconfirmed
GUEST, unregistred user!
调用Windows中的Cards.dll的函数cdtdraw画出来的扑克牌如何擦除掉啊?
因需要换牌,所以重新画了高度-20的,也就是有上浮的功能,
但旧的之前画的扑克牌要如何删除掉啊?谢谢
 
或许有点用
http://www.winehq.com/hypermail/wine-devel/2003/07/0691.html
Cards.dll exports 7 different functions.
These are:
cdtInit
cdtTerm
cdtAnimate
cdtDraw
cdtDrawExt
DllMain
and WEP

cdtInit takes 2 int * variables. It should return TRUE if the initalization
was sucessfull and FALSE if it was not.
It is a place to do any initalization you require (depending on for example
if you want to preload the resource bitmaps or whatever).
It should return the x and y size of the card bitmaps in the 2 variables.
For the cards I am using, the x size is 71 and the y size is 96 (which just
happened to match up with the size of microsofts cards which is good)

the main purpose of DllMain is to store the HINSTANCE of the cards.dll to
use later when the bitmaps are loaded

WEP is a holdover from when cards.dll was a 16 bit dll and doesnt actually
need to be implemented (since its never called by 32 bit windows)

cdtTerm is where you undo anything you did in cdtInit (such as unloading
any preloaded resources)
It takes no parameters and returns nothing.

cdtAnimate is supposed to handle animations for the card backs but since
the backs we are using dont animate, it can just return TRUE
(hence why the resource file I wrote returns the windows XP version number
since XP doesnt have animated backs either)
As for parameters, it takes a HDC, an x and y position and a frame number
(each individual microsoft back has a specific number of frames and
applictions tend to hard-code these values)

cdtDraw basicly calls cdtDrawExt passing the default size of the card
bitmaps as the x and y size parameters
 
扑克牌我是画出来了,但我想要实现上浮功能(重新画)时如何删除旧的之前画的扑克牌,
DLL中应该没有这个擦除函数啊,谢谢!
 
晕,都画上去了怎么擦除?本来就没有擦除函数可以供你用。很简单的解决办法,用一个Bitmap保存背景,用另外一个Bitmap保存扑克,把两个Bitmap画到第三个Bitmap上,先画背景的,再画扑克,当要上浮扑克的时候,画一次背景,再把扑克的top减小点继续画上去,不就OK了?
 
我試一下..
 
When your code draws the card image it draws it directly to your
Form. The effect of this depends on whether your Form's Autoredraw propewrty
is set to True or False. Presumably you will have set it to True. If you
haven't then I would strongly suggest that you do so, otherwise the drawn
image will disappear when the user drags the Form about the display and
drags it over "the edge". Anyway, as I was saying, the image is drawn into
your Form, and if you cover it up with something else (an image control in
your example) then that's all it will be - a drawing of a card covered over
by something else. To "undraw" it you need to draw something else to your
Form directly over the top of the drawing of the card. You can use
PaintPicture or the appropriate API function to do this. However, I would
suggest that you tacjkle the entire job in a quite different way and instead
of drawing a card make a "sprite" of it. You could do this at run time of
the Form Load event so that you start off with an array of 52 "sprite
drawings" plus one "mask drawing" that you can use for all of them. In that
way you will be able to smoothly animate your cards over any background you
want (a picture if you wish). You can then get your cards to glide smoothly
from one position to another instead of just suddenly appearing at the new
position.
 
后退
顶部