Hurol Aslan

Hurol Aslan

  • NA
  • 1
  • 0

how to redraw a user control without flickering?

Feb 3 2006 6:37 AM
Hello folks,

In a simple game program written with C# on Visual Studio 2005, I am using a user conrol with about 20 picture boxes that will display the images of game pieces. The user control docks in a way to fill the lower pane of the form representing the game board. If that pane is resized, the user conrol repositions the picture boxes so that they all keep the aspect ratios the same and they are always distributed equidistantly. That code is placed in SizeChanged event handler of my user control.

However, I have a flickering problem. I do call SuspendLayout and ResumeLayout before and after repositioning the picture boxes, but that changes nothing. When I try to debug, that creates an endless stream of sizechange events and I can't find out if my code fails somwhere. I tried responding to Layout event instead of SizeChanged event, but that did not help either.

Any suggestions on how to handle this?

Best wishes to all programmers in the world.

Hurol Aslan, Mersin, Turkey

Answers (1)