double buffering for flickering problem
-
Hi, i have a form with a panel. In this panel, it allow the shapes drawn (using graphicspath) to be drag and drop. However, there is the flickering problem whenever i drag any of the shapes. i tried to use the SetStyle function like below:
public class DoubleBufferPanel : Panel { public DoubleBufferPanel() { // Set the value of the double-buffering style bits to true. this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint |ControlStyles.AllPaintingInWmPaint, true); this.UpdateStyles(); } }
however, it generates the error below:An unhandled exception of type 'System.ArgumentException' occurred in system.drawing.dll Additional information: Invalid parameter used.
Any suggestion on what should i do? Thanks in advance -
Hi, i have a form with a panel. In this panel, it allow the shapes drawn (using graphicspath) to be drag and drop. However, there is the flickering problem whenever i drag any of the shapes. i tried to use the SetStyle function like below:
public class DoubleBufferPanel : Panel { public DoubleBufferPanel() { // Set the value of the double-buffering style bits to true. this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint |ControlStyles.AllPaintingInWmPaint, true); this.UpdateStyles(); } }
however, it generates the error below:An unhandled exception of type 'System.ArgumentException' occurred in system.drawing.dll Additional information: Invalid parameter used.
Any suggestion on what should i do? Thanks in advance -
Hi, i have a form with a panel. In this panel, it allow the shapes drawn (using graphicspath) to be drag and drop. However, there is the flickering problem whenever i drag any of the shapes. i tried to use the SetStyle function like below:
public class DoubleBufferPanel : Panel { public DoubleBufferPanel() { // Set the value of the double-buffering style bits to true. this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint |ControlStyles.AllPaintingInWmPaint, true); this.UpdateStyles(); } }
however, it generates the error below:An unhandled exception of type 'System.ArgumentException' occurred in system.drawing.dll Additional information: Invalid parameter used.
Any suggestion on what should i do? Thanks in advanceHi, you must use the line numbers: - tell Visual to show line numbers (see my sig, tip 1) - look at the exception's line numbers (see my sig, tip 2) Good luck !
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google