I need to build a Tile-based Map Editor in #C Winforms. My main concern is drawing the tiles. In what space should I draw the tiles? Within a Panel? A Picture Box?

Also, I obviously need to draw textures over the tiles too. Does this mean my tiles need to have a pictureBox component? Or can I do this some other way?

I apologize if this is too broad a question. I've been researching but I can't exactly find the info I'm looking for.


  • 1
    You should first start with simplest solution you can think off. Using panel with multiple picture boxes might work for now.
    – Euphoric
    Aug 8 '16 at 5:37

You can use a Panel and then override its OnPaint method.

Overriding the OnPaint Method (MSDN WinForms)

The OnPaint method will receive a PaintEventArgs argument, which will contain a property that is a System.Drawing.Graphics. You will be drawing everything by calling methods on this object.

Graphics.DrawImage methods (MSDN System.Drawing)

This requires you to do some coordinate calculations that involve scaling (multiplications) and cropping (coordinate translations).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.