Using windowsform: Help with GDI+ image drawing on newest questions tagged winforms – Stack Overflow

I’ve recently taken my first step into GDI+, and am trying to draw an image from a bitmap.
The code I have is this:

using System.Drawing;
using System.Drawing.Drawing2D;

namespace Windowstuffs
{
    class AnimEngine : Form
    {
        public Graphics X;
        public Bitmap Y = new Bitmap(/* File Path */);

       void draw(object sender, PaintEventArgs e)
        {
            Bitmap Y = new Bitmap(/* File Path */);
            e.Graphics.DrawImage(Y, 0, 0);
            return;
        }

       public static void Main()
        {

            AnimEngine f1 = new AnimEngine();
            Application.Run(f1);
            f1.Paint += new PaintEventHandler(f1.draw);
            f1.Refresh();
            return;
        }

    }
}

It compiles just fine, however, it doesn’t draw anything. Everything else is completely functional, and after searching through MSDN and various tutorials, I still cannot find what I did wrong.

Thank you for your help.

See Answers


source: http://stackoverflow.com/questions/6174536/help-with-gdi-image-drawing
Using windowsform: using-windowsform



online applications demo