To briefly explain:
- I have a win form written in C# that contains a panel.
- The panel contains a shape container, through that I have programmatically added some oval and line shape controls from VisualBasic.PowerPacks to the panel.
- The reason of using such shapes was I needed to perform some operations on their MouseHover and MouseClick events.
- I have also drawn some graphics like strings and ellipse on the panel using Graphics in Paint(object sender, PaintEventArgs e) method of the panel.
- The application has zoom in and zoom out buttons and whenever user clicks on them the size of shapes and graphics are supposed to be changed based on the scale.
- To redraw graphics after scaling, I needed to clear the old ones before drawing new graphics in the new scale, otherwise they remained on the panel. So, I used Clear(Color color) method of the graphic to do so.
Now, the problem I have is upon using Clear(Color color), everything including shape controls gets disappeared. By my perception, I do not expect shapes to be disappeared because they should be treated as controls, unless I am missing something here. How can I avoid this issue? Any advice would be appreciated.
Solved the problem by invalidating "shape.Invalidate()" shape controls.