[System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
private void definir_arriere_plan_bureau()
{
OpenFileDialog odlg = new OpenFileDialog();
odlg.Filter = "Images Bitmap (*.bmp,*.BMP)|*.BMP;*.BMP";
if (odlg.ShowDialog()==DialogResult.OK)
{
string filename = odlg.FileName;
string subname;
if (filename.Length > 3)
{
subname = filename.Substring(filename.Length - 3, 3);
if (subname == "bmp" || subname == "BMP")
{
SystemParametersInfo(20, 0, filename, 0x1 | 0x2);
//MessageBox.Show("L'image définie est désormais ","Bureau modifié"+System.Environment.UserDomainName);
}
else
{
//MessageBox.Show("selectionner une image bitmap (.BMP) ","Attention..."); End If
}
}
}
}