views:

82

answers:

1

Hi, I am trying to develop a custom control which needs to have some rectangles to be drawn. Now, 1 rectangle needs to be moved so I used overrided mousemove method to get the new location and change the location part of that rectangle and then used Invalidate() command. But problem is, that whole control is painted instead of that rectangle. It is disaapearing. If someone can point out where I am doing wrong, that would be a great help. Thanks.

A: 

You can use partial invalidate using Invallidate() overloads. pass a rectangle as a parameter to Invalidate() or you can pass 4 number to do it.

Invalidate(new Rectangle(left, top, width, height));

of course you must invalidate rectangle's old place and new place.

Navid Farhadi
ok, let me try that.
Mohit