I've used this piece of code to put an image in a variable. What I wanna do is draw dots on it on various places and then save the result.
What I do is I open a dialog to select the file and to check if it worked, I put it in a picturebox. Using winforms offcourse. Using Visual Studio 2008 Professional.
EDIT:the openImg
variable you see used below as the name I gave the openFileDialog instance I'm using.
private string CurrentFile;
private Image img;
private void fileToolStripMenuItem_Click(object sender, EventArgs e)
{
openImg.Title = "Open Image File";
openImg.Filter = "JPEG Files|*.jpg" +
"|Enhanced Windows MetaFile|*.emf" +
"|Exchangeable Image File|*.exif" +
"|Gif Files|*.gif|Icons|*.ico" +
"|PNG Files|*.png|TIFF Files|*.tif|Windows MetaFile|*.wmf";
openImg.DefaultExt = "jpg";
openImg.FilterIndex = 1;
openImg.FileName = "";
openImg.ShowDialog();
if (openImg.FileName == "")
{
return;
}
CurrentFile = openImg.FileName.ToString();
img = Image.FromFile(openImg.FileName);
pictureBox1.Image = img;
}
So far so good.
With this first stage done, I wanted to define a Color object, sothat I can use it to draw at certain locations later.
I've never worked with them before though.
Color yellow = new Color();
I realize that just naming it "yellow" won't make it yellow, but I'm not given the option to select a color... Visual Studio didn't even show the variable in the autocomplete. I'm kinda stumped. What I wanna do is define a certain region on the image to draw in a certain color.