Search code examples
c#gdi+system.drawing

how drag a shape in picture box?


I have a project that in those i draw some shape from some layer. For example I have two circle in circle Layer and three rectangle in rectangle Layer and so on.I draw the result with call Layer.Draw and marge the layers result with a Graphics object. I can select one shape in picture box and specify it on layer. and i can drag it with redraw its layer and re marge all with graphics.it works ! but too slow!!

how i can optimize this?


Solution

  • in old solution i draw shapes into layer.image and in on Paint event marge they with e.Graphic. I solve this problem with passing the graphic object into layers and draw shapes with it. my program work very good!