PDA

View Full Version : عوض کردن backgrand ویندوز



محمد صادق
دوشنبه 01 آبان 1385, 05:09 صبح
سلام
چطوری توی c# می توان backgrand ویندوز را عوض کرد؟

Amir Oveisi
دوشنبه 01 آبان 1385, 13:42 عصر
میتونی از WMI استفاده کنی

محمد صادق
دوشنبه 01 آبان 1385, 23:02 عصر
بسمه تعالی
سلام
ممنون میشم اگه برنامه کامل اون رو بنویسید چون من قبلا با ++c کار کردم و تازه می خوام با #c کار کنم

dot_net_lover2
جمعه 05 آبان 1385, 00:35 صبح
private const int SPI_SETDESKWALLPAPER = 0X14;
private const int SPIF_UPDATEINIFILE = 0X1;
private const int SPIF_SENDWININICHANGE = 0X2;
[DllImport("USER32.DLL",EntryPoint="SystemParametersInfo", SetLastError = true)]
private static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
// change this to whatever filename you want to use
private const string WallpaperFile = "MovieCollectionImage.bmp";
// <SUMMARY>
// Sets the background of your Windows desktop.
// The image will be saved in MyPictures and the background
// wallpaper updated.
// </SUMMARY>
// The image to be set as the background.
// <REMARKS></REMARKS>
internal void SetWallpaper(Image img)
{
string imageLocation;
imageLocation = System.IO.Path.GetFullPath(System.Environment.Spec ialFolder.MyPictures.ToString() + WallpaperFile);
try
{
img.Save(imageLocation, System.Drawing.Imaging.ImageFormat.Bmp);
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, imageLocation, SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
}
catch (Exception Ex)
{
MessageBox.Show("There was an error setting the wallpaper: " + Ex.Message);
}
}