using System;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
class Program.
{
const int SPI_SETDESKWALLPAPER = 0x0014;
const int SPIF_UPDATEINIFILE = 0x01;
const int SPIF_SENDCHANGE = 0x02;
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form form = new Form();
Button changeWallpaperButton = new Button();
changeWallpaperButton.Text = "Arkaplanı Değiştir";
changeWallpaperButton.Click += ChangeWallpaperButton_Click;
form.Controls.Add(changeWallpaperButton);
Application.Run(form);
}
private static void ChangeWallpaperButton_Click(object sender, EventArgs e)
{
// İstediğiniz fotoğrafın yolunu aşağıdaki satıra ekleyin.
string imagePath = @"C:\Path\To\Your\Image.jpg";
// Masaüstü arkaplanını değiştir.
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, imagePath, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
// Belirli bir süre sonra orijinal arkaplana geri dön.
Thread.Sleep(5000); // Örnek olarak 5 saniye bekletme süresi.
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, imagePath, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
}
}
Başlangıç için yeterli bir kod. Kodu iyice geliştirebilirsin.