DraguVaso
Tue Jul 26 02:59:31 CDT 2005
That's indeed a good remark. Although the Paint-event repaints every time
the whole DataGrid, so I need to repaint my stuff also each time :-/ it
should be nicer indeed if I could disable some things to be repainted, but
idon't know if something like that is possible or not.
with disabling the paint of the background I guess saved alreaddy some
time...
"Dennis" <Dennis@discussions.microsoft.com> wrote in message
news:CE855BC3-CBAE-4A18-B241-69962DEE4C9F@microsoft.com...
> I'm not sure but I think one disadvantage to the method you are using with
> the _BackBuffer is that you are repainting the entire control each time
the
> paint event is fired rather than just the invalidated
rectangle...depending
> on what you are painting each time, maybe you have to do this.
> --
> Dennis in Houston
>
>
> "DraguVaso" wrote:
>
> > Hi,
> >
> > I did that already. I based my solution to this:
> > www.bobpowell.net/doublebuffer.htm
> >
> > although by relooking to it I think I'm having automatic and manual
double
> > buffering together in my application, hehe :-)
> >
> >
> > "Ken Tucker [MVP]" <vb2ae@bellsouth.net> wrote in message
> > news:uoyzFkqjFHA.2904@tk2msftngp13.phx.gbl...
> > > Hi,
> > >
> > > Why dont you use setstyle for the control to doublebuffer.
> > >
> > >
> >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclasssetstyletopic.asp
> > >
> > > Ken
> > > ----------------------
> > > "DraguVaso" <pietercoucke@hotmail.com> wrote in message
> > > news:eKTpdSqjFHA.476@TK2MSFTNGP14.phx.gbl...
> > > Hi,
> > >
> > > I have my custom Inherited DataGrid. I override the OnPaint-event to
speed
> > > up things and avoid flikkering using Double Buffering. To draw the
normal
> > > things of the DataGrid I have to call the MyBase.OnPain(pe). But in my
> > > opinion it doesn't seem to be painted on the buffer. Everything works
> > fine,
> > > but I think it should work better if my MyBase.OnPaint also painted in
my
> > > buffer.
> > >
> > > Am I wrong? And how should I do this? I kind of need to link the
> > pe-argument
> > > to my g-object?
> > >
> > > This is the code :
> > >
> > > Protected Overrides Sub OnPaint(ByVal pe As
> > > System.Windows.Forms.PaintEventArgs)
> > > 'DoubleBuffer-functions********
> > > If _backBuffer Is Nothing Then
> > > _backBuffer = New Bitmap(Me.ClientSize.Width,
> > > Me.ClientSize.Height)
> > > End If
> > >
> > > Dim g As Graphics = Graphics.FromImage(_backBuffer)
> > > 'Paint on the Graphics object here
> > > 'DoubleBuffer-functions********
> > >
> > > MyBase.OnPaint(pe)
> > >
> > > 'I do my special stuff here with the g-object (custom cilumnheaders
etc
> > > '....
> > >
> > >
> > > 'DoubleBuffer-functions********
> > > g.Dispose()
> > > 'Copy the back buffer to the screen
> > > pe.Graphics.DrawImageUnscaled(_backBuffer, 0, 0)
> > > 'DoubleBuffer-functions********
> > > End Sub
> > >
> > > Thanks a lot in advance!
> > >
> > > Pieter
> > >
> > >
> > >
> >
> >
> >