Question Duplicating Shapes

solfinker

Well-known member
Joined
Aug 6, 2013
Messages
71
Programming Experience
Beginner
Hello!
I am using the straightforward code to position my shapes:

VB.NET:
Expand Collapse Copy
Form1.OvalShape1.Top = Formdgv.dgv1(x, y).Value * 4000 + 200

and so on

It happens that the shape duplicates at every Loop, when I just wanted it to move. After the first Loop I have 8 shapes, after the 2nd 16 shapes, 24 after the 3rd ...

But all this happens ONLY when Formdgv.dgv1(x, y) is different from 0.

I'm completing a 10 rows datagriedview up from the bottom: the first Loop I fill the 10th row, the second Loop the 9th equals the former 10th, and so on.

Any hints?

Thank you so much.
 
I can't reproduce it, but generally an application will not process any events, including painting, during a loop. It will be inresponsive and you may see weird partial redrawing effects.
 
Taking the shapes positioning out of the Loop, doesn't help.
However, I have cut down the number of shapes to the fourth - I have now 4 forms with 24 different shapes each one - and now it works.
It must have been a sort of indigestion.

Thank you for your help.
 
Back
Top