0

Bit about it: We're building a level editor in Visual Studio using C#, importing long gone editted maps. These tile-maps have multiple layers and consist of multiple tiles. They are all shown on top of eachother. To finish off there should be a selectionbox to select a tile.

Our current aproach: Create 'Panel' objects within a form for each layer of a tile-map. When done loading every layer with a corresponding panel, we stack all panels into eachother, 'Parent'ing every layer to it's next layer. Selectionbox panel gets a parent too at the end. (WHY? When not doing this, the top layer would set it's background to the form. Which is grey. 2nd layer wouldn't be visible). So it would look like... SelectionBoxPanel -> Panel_3 -> Panel_2 -> Panel_1 -> BackgroundPanel.

Problem: When calling the paint event of selectionBoxPanel (when moving over the scene), every parent panel gets redrawn. Obvious it takes alot of CPU and every tile on the layer gets refreshed!

Question: Is there a different file (like shader file), or object (like panel) or anything at all we can use for graphical representations of these layers?

John W
  • 3
  • 5

1 Answers1

0

We fixed the problem,

  1. We changed all panels to pictureboxes. (We lost scroll functionality, but are currently working on that).

  2. Went from Parenting to "Controls.Add(Child)" methods instead, because Pictureboxes don't include parenting options.

  3. Applied Double Buffering to all pictureboxes.

Done.

John W
  • 3
  • 5