4

I want to create a level editor, using a Windows Forms Application.

Here is the layout that i want to achieve:

enter image description here

BLUE -> Windows form control

PURPLE -> Canvas, handled differently (Yeah, Windows forms controls too, but not for the same use of it)

I have a problem though, how to render the Canvas in a proper way without using a thread ?

(Look at my other thread here: Access object from other thread)

I thought about a timer, but I don't know if it's reliable.

Ideally a thread would be nice but Windows doesn't like the fact that you want to interact between thread so it's messed up to be polite.

If you know how to achieve that, well, thanks ! :)

Community
  • 1
  • 1
Riptide
  • 385
  • 7
  • 17
  • 3
    Any reason for a timer? Why not just make the Canvas a `UserControl` and place the rendering code in the `OnPaint`. If you are worried about flickering look into `DoubleBuffered` or render to an offscreen bitmap and _blit_ it in one go –  Apr 06 '15 at 01:17
  • Thanks for the tip, I'll post if I got news and read some documentation. For the timer I wanted to do a kind of a frame that we have in games and refreshes every X fps. But there's flickering, so I'll see if i can do it with your answer. – Riptide Apr 06 '15 at 08:18
  • _"refreshes every X fps. But there's flickering"_ - check out my answer to this post _[Avoiding creating PictureBoxes again and again](http://stackoverflow.com/questions/28510262/avoiding-creating-pictureboxes-again-and-again/28510720#28510720)_ for _Flicker Free Offscreen Rendering UserControl_. Full code sample included –  Apr 08 '15 at 09:08

0 Answers0