c#实现水波特效

很简单,就是调用罗云斌老师做好的DLL。
附上源码!

ContractedBlock.gif ExpandedBlockStart.gif Code
 1using System;
 2using System.Collections.Generic;
 3using System.ComponentModel;
 4using System.Data;
 5using System.Drawing;
 6using System.Text;
 7using System.Windows.Forms;
 8using System.Runtime.InteropServices;
 9
10namespace water
11ExpandedBlockStart.gifContractedBlock.gif{
12    public partial class Form1 : Form
13ExpandedSubBlockStart.gifContractedSubBlock.gif    {
14        public Form1()
15ExpandedSubBlockStart.gifContractedSubBlock.gif        {
16            InitializeComponent();
17        }

18
19        [DllImport("Wave.dll")]
20        public static extern int E_WaveInit(IntPtr hwnd, string bmpStr);//初始化对象
21        [DllImport("Wave.dll")]
22        public static extern int E_AutoEffects(int type, int type1, int type2, int type3);//效果类型
23        [DllImport("Wave.dll")]
24        public static extern int E_WaveDropStone(int x,int y,int dx,int zl);//仍石头
25        [DllImport("Wave.dll")]
26        public static extern void E_WaveFree();//释放对象
27
28        Random r = new Random();//置随机数种子
29
30        private void Form1_Load(object sender, EventArgs e)
31ExpandedSubBlockStart.gifContractedSubBlock.gif        {            
32            E_WaveInit(this.Handle, Application.StartupPath + "\\wave.bmp");
33            E_AutoEffects(2,0,0,0);            
34        }

35
36        private void btnXY_Click(object sender, EventArgs e)
37ExpandedSubBlockStart.gifContractedSubBlock.gif        {
38            E_AutoEffects(1, r.Next(325), r.Next(05), r.Next(50250));
39        }

40
41        private void btnCZ_Click(object sender, EventArgs e)
42ExpandedSubBlockStart.gifContractedSubBlock.gif        {            
43            E_AutoEffects(2, r.Next(37), r.Next(15), r.Next(100500));
44        }

45
46        private void btnFL_Click(object sender, EventArgs e)
47ExpandedSubBlockStart.gifContractedSubBlock.gif        {
48            E_AutoEffects(3, r.Next(50300), r.Next(25), r.Next(510));
49        }

50
51        private void btnStop_Click(object sender, EventArgs e)
52ExpandedSubBlockStart.gifContractedSubBlock.gif        {
53            E_AutoEffects(0000);
54        }

55
56        private void btnDispos_Click(object sender, EventArgs e)
57ExpandedSubBlockStart.gifContractedSubBlock.gif        {
58            if (btnDispos.Text == "卸载")
59ExpandedSubBlockStart.gifContractedSubBlock.gif            {
60                E_WaveFree();//释放资源
61                btnDispos.Text = "加载";
62            }

63            else
64ExpandedSubBlockStart.gifContractedSubBlock.gif            {
65                E_WaveInit(this.Handle, Application.StartupPath + "\\wave.bmp");
66                btnDispos.Text = "卸载";
67            }

68
69        }

70
71        private void btnExit_Click(object sender, EventArgs e)
72ExpandedSubBlockStart.gifContractedSubBlock.gif        {
73            E_WaveFree();//释放资源
74            Application.Exit();
75        }

76
77        private void Form1_MouseMove(object sender, MouseEventArgs e)
78ExpandedSubBlockStart.gifContractedSubBlock.gif        {
79            E_WaveDropStone(e.X, e.Y, r.Next(05), r.Next(300800));
80        }

81
82        private void Form1_MouseDown(object sender, MouseEventArgs e)
83ExpandedSubBlockStart.gifContractedSubBlock.gif        {
84            E_WaveDropStone(e.X, e.Y, r.Next(05), r.Next(300800));
85        }

86    }

87}

88

 
这里没有做过多的解释,菜鸟的人也可以看懂!
需要源码的话,请点击这里下载

转载于:https://www.cnblogs.com/feiyangqingyun/archive/2009/10/06/1578387.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值