WinForms/C# 中的动画效果 [英] Animation Effects in WinForms/C#

查看:36
本文介绍了WinForms/C# 中的动画效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在粘贴正在构建的游戏中的图像.您看到的空单元格矩阵由 PictureBox[][] 组成.每当我将硬币扔到其中一个柱子上时,我都不会......我希望它掉下来,但紫色的东西会隐藏掉下的硬币,而你看到的灰色不会隐藏它.我如何制作这种效果?请注意,在每个 PictureBox 控件中,我都设置了 BG Image,如您所见

I'm pasting an image from the game im building. the matrix of empty cells you see are made of PictureBox[][]. I wan't whenever I drop a coin to one of the columns... I want it to go down but the purple stuff will hide the falling coin and the gray color you see wont hide it. How do I make this effect? please notice that in each PictureBox control I have set the BG Image as you can see

推荐答案

不要那样做.

创建自定义控件.在自定义控件中,覆盖 Paint,然后先绘制 COIN 精灵,然后在其上绘制蒙版.请务必在此处使用双缓冲绘画.

Create custom control. In custom control, override Paint, and then draw COIN sprite first, then draw mask over it. Be sure that you use double-buffered painting here.

它会像魅力一样发挥作用,相信我!

It will work like a charm, trust me!

而且,由于您(我猜)在这里构建 5 连胜游戏,您的自定义控件也将能够绘制已占用的插槽.

And, since you are (I gueess) building 5-in-a-row game here, your custom control will be able to paint occupied slots as well.

通过设计自定义控件,您将能够隐藏主窗体之外的所有动画和图形内容.

By designing custom control, you'll be able to hide all the animation and graphics stuff away from your main form.

这篇关于WinForms/C# 中的动画效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆