c#桌面飘雪小程序,兼容win7

这是一个使用C#编写的桌面飘雪小程序,经过修改后能够兼容Windows 7系统。程序通过GDI+库实现雪花飘落效果,并提供了定时更新雪花位置的机制。
摘要由CSDN通过智能技术生成


c#桌面飘雪小程序,之前在网上查到过代码,但有很多错误,并且在win7下无法运行。

将其改成c#代码,并测试,效果如上图,可兼容XP和win7系统均可运行。 其主要代码如下:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Runtime.InteropServices;


namespace WindowsXueJi04
{
    public partial class Form1 : Form
    {
        [DllImport("gdi32.dll")]
        static extern int SetPixel(IntPtr hSdc, int x, int y, int crColor);
        [System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")]
        public static extern IntPtr CreateDC(string lpszDriver, string lpszDevice, string lpszOutput, int lpInitData);
        [DllImport("gdi32.dll")]
        public static extern int DeleteDC(IntPtr hdc);


        static int SnowNumber = 600;
        public SnowNode[] SnowNodes = new SnowNode[SnowNumber];
        int CrWind = 0;
        int ScreenWidth;   //屏幕宽度
        int ScreenHeight;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值