general double buffering

  • Thread starter Thread starter martin
  • Start date Start date
M

martin

Hello
Does anyone know how to implement double buffering
to a form (not just when manually drawing with graphics)?
I have any graphical elements (labels and buttons with images,form is
irregular and has brush background etc) and I would like to somehow enforce
automatic doublebuffering when form is being redrawn (or at least when
datagrid is being redrawn as it has derived column styles with different
brushes and textures on its fields).
 
Martin,
In the constructor of your Form try:

SetStyle(ControlStyles.UserPaint, True)
SetStyle(ControlStyles.DoubleBuffer, True)
SetStyle(ControlStyles.AllPaintingInWmPaint, True)
UpdateStyles()

This is for the Form itself, if you want the DataGrid to double buffer, you
will need use this in your custom DataGrid class. However I'm not sure how
well it will or will not work with the DataGrid.

I use it in a couple of custom controls with success...

Hope this helps
Jay
 
Back
Top