桌面小宠物项目开发_C# 桌面宠物 示例源码(透明窗体)

【实例简介】

可以按时叫你吃饭可以控制在桌面上行走等等等等。。。。。。。。。。。。

【实例截图】

【核心代码】

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Media;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using SpeechLib;

using System.Threading;

namespace 不做单身狗__桌面宠物

{

public partial class cw : Form

{

private string a;

bool run = false,bf=false ;

SoundPlayer zl;

Form1 f = new Form1();

public cw(string str)

{

InitializeComponent();

this.a = str;

TransparencyKey = BackColor;

pictureBox1.Focus();

}//构造函数

private void cw_Load(object sender, EventArgs e)//加载宠物

{

zheng();

ts.Start();

}

#region 宠物动作

public void qian()

{

if (run == false)

{

System.Reflection.Assembly assembly;

assembly = System.Reflection.Assembly.GetExecutingAssembly();

zl = new SoundPlayer(Properties.Resources.走路);

zl.PlayLooping();//循环播放

if (a == "男1") { pictureBox1.Image = Properties.Resources.男1前; }

if (a == "男2") { pictureBox1.Image = Properties.Resources.男2前; }

if (a == "男3") { pictureBox1.Image = Properties.Resources.男3前; }

if (a == "女1") { picture

你可能感兴趣的:(桌面小宠物项目开发)