您现在的位置是:网站首页> 软件下载软件下载

设置桌面壁纸(定时自动换壁纸)下载绿色版带源码-为图片添加当月的日历并设为壁纸软件下载

2021-05-18 111人已围观

简介 设置桌面壁纸(定时自动换壁纸)下载绿色版带源码-为图片添加当月的日历并设为壁纸软件下载

winform 为图片添加当月的日历并设为壁纸,可以手动设置壁纸,也可以定时设置壁纸;最主要的特色是在图片上生成当前月的日历信息。

定时自动换壁纸需要自己手工制定壁纸文件夹,不是从网上自动下载。

部分代码:

///


/// 定时自动设置壁纸
///

private void btnAutoSet_Click(object sender, EventArgs e)
{
string path = txtPicDir.Text;
if (!Directory.Exists(path))
{
MessageBox.Show("选择的文件夹不存在");
return;
}
DirectoryInfo dirInfo = new DirectoryInfo(path);
picFiles = dirInfo.GetFiles("*.jpg");
if (picFiles.Length == 0)
{
MessageBox.Show("选择的文件夹里面没有图片");
return;
}
if (btnAutoSet.Text == "开始")
{
timer1.Start();
btnAutoSet.Text = "停止";
lblStatus.Text = string.Format("定时自动换壁纸中...");
}
else
{
timer1.Stop();
btnAutoSet.Text = "开始";
lblStatus.Text = "";
}
}
///
/// 定时随机设置壁纸
///

private void timer_Tick(object sender, EventArgs e)
{
timer1.Interval = 1000 * 60 * (int)numericUpDown1.Value;
FileInfo[] files = picFiles;
if (files.Length > 0)
{
Random random = new Random();
int r = random.Next(1, files.Length);

Bitmap img = (Bitmap)Bitmap.FromFile(files[r].FullName);
pictureBox1.Image = img;

SetWallpaper(img);
}
}

下载资源

-六神源码网