Question

Though I have experience in C, I'm totally new to Object oriented programming, so, if it's not too much to ask, I'd like you to help me at giving me just 1 example of using this method: http://msdn.microsoft.com/en-us/library/ms142040(v=vs.110).aspx in C#. Its not for homework, since I'm an enthusiastic programmer, what happens is that I learn by example, and I want an example of this:

A form that has 1 button which when pressed shows 1 image - could be a bmp or anything - I would really appreciate your help.

I also learned C for programming micro controllers by reading examples, not by understanding theory.

Was it helpful?

Solution

I'm not going to give you a complete code-on-a-platter direct answer, but here is a way to hopefully get you started. Try using the Button_Click event handler and this.CreateGraphics().

private void button1_Click(object sender, EventArgs e)
{
    Bitmap image = new Bitmap(@"C:\Users\X\Pictures\CAROLINAPANTHERS.png");
    Graphics x = this.CreateGraphics();
    x.DrawImage(image,new Rectangle(0,0,image.Width, image.Height), ...);
}

LMK if this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top