Reputation: 213
I am trying to learn C# and I want to know how to make a little program to change the desktop background to an image I embedded in the resources.
Upvotes: 1
Views: 2544
Reputation: 10347
First get Image from your resource:
var bmp = new Bitmap(
System.Reflection.Assembly.GetEntryAssembly().
GetManifestResourceStream("MyProject.Resources.myimage.png"));
or
var bmp = new Bitmap(WindowsFormsApplication1.Properties.Resources.myimage);
Second Save image to specify Path using Image.Save
.
Finally change desktop background using this code from a SO post:
Upvotes: 2