Nasıl Yapılır

C# İle Örnekler #59

c

C# Masaüstü Arka Plan Resmini Değiştirme

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices; //Ekle
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace wallpaper
{
    public partial class Form1 : Form
    {
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        private static extern Int32 SystemParametersInfo(UInt32 action, UInt32 uParam, String vParam, UInt32 winIni);
 
        public Form1()
        {
            InitializeComponent();
        }
 
        public void DuvarKagidiAyarla(String yol)
        {
            SystemParametersInfo(0x14, 0, yol, 0x01 | 0x02);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog dosya = new OpenFileDialog();
            dosya.Filter = "Resim Dosyası |*.jpg;*.nef;*.png| Video|*.avi| Tüm Dosyalar |*.*";
            dosya.Title = "www.hizhosting.com";
            dosya.ShowDialog();
            string DosyaYolu = dosya.FileName;
            DuvarKagidiAyarla(DosyaYolu);
 
        }
    }
}

 

Yazar Hakkında

Hız Hosting

Yorum Yap