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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top