How to add images to the project?
My main recommendation: do not do it using Visual Studion image editor. The images will be embedded in the resource file; it will render the resource file unmanageable and hard to support. Also, there are some much better free editors around. (I would recommend GIMP and InkSkape (vector, but supports exports to anything, importantly to XAML)). So, you create some files and put them in some resource directory within your project. In the same directory, create new
*.resx
resource and click "Add Resource" -> "Add Existing File", proceed. Your graphic files will be added to the project and to the resource. Use auto-generated C# files under resource node to access the images. Prefer PNG.
How to add images to buttons?
Add a button. Click its Properties. Locate the property
Image
and click on the "ellipsis" button. It will show you your resources and selection of the image to associate with the button.
Programmatically...
Panel parent =
Button button = new Button();
button.Image =
button.Text = "Some &Text";
button.Width =
button.Top =
button.Left =
parent.Controls.Add(button);
—SA