Home All Groups Group Topic Archive Search About

really daring subject! DataGrid MyBase.OnPaint -> content

Author
6 Jul 2005 11:34 AM
DraguVaso
Hi,

I want to override the MyBase.OnPaint(ByVal pe As
System.Windows.Forms.PaintEventArgs) of the DataGrid, to have some custom
property's designed (other column headers etc).

The problem is that I don't know the content of the original MyBase.OnPaint,
so I don't know what I need to put in my overriden Sub. does anybody knows
the content of it? Or is there a way to figure it out? Maybe somewhere in
the pe-argument?

Any help would be really appreciated!

thanks a lot,

Pieter Coucke

Author
6 Jul 2005 3:06 PM
Phill. W
"DraguVaso" <pietercou***@hotmail.com> wrote in message
news:uZu2y6hgFHA.1284@TK2MSFTNGP14.phx.gbl...
> I want to override the MyBase.OnPaint() of the DataGrid,
.. . .
> The problem is that I don't know the content of the original
> MyBase.OnPaint, so I don't know what I need to put in my
overriden Sub.
.. . .
> is there a way to figure it out?

1. Override OnPaint with a routine containing no code at all.
2. Run your application.

The base method did whatever /doesn't/ happen any more ;-))

HTH (but doubt it),
    Phill  W.
Are all your drivers up to date? click for free checkup

Author
6 Jul 2005 3:22 PM
DraguVaso
Hehehe thanks, I tried that alreaddy before, and it was like that that I
figured out Ireally needed the orignal code in it, hehe :-)

Show quoteHide quote
"Phill. W" <P.A.Ward@o-p-e-n-.-a-c-.-u-k> wrote in message
news:dagrjk$622$1@yarrow.open.ac.uk...
> "DraguVaso" <pietercou***@hotmail.com> wrote in message
> news:uZu2y6hgFHA.1284@TK2MSFTNGP14.phx.gbl...
> > I want to override the MyBase.OnPaint() of the DataGrid,
> . . .
> > The problem is that I don't know the content of the original
> > MyBase.OnPaint, so I don't know what I need to put in my
> overriden Sub.
> . . .
> > is there a way to figure it out?
>
> 1. Override OnPaint with a routine containing no code at all.
> 2. Run your application.
>
> The base method did whatever /doesn't/ happen any more ;-))
>
> HTH (but doubt it),
>     Phill  W.
>
>
Author
6 Jul 2005 5:47 PM
Chris Dunaway
Download Reflector and take a look at it yourself.  It will show the
code in VB, C# or Delphi!
Author
7 Jul 2005 7:06 AM
DraguVaso
Wow that's just a great tool!!!!!
Thanks a lot!!! :-)


Show quoteHide quote
"Chris Dunaway" <dunaw***@gmail.com> wrote in message
news:1120672074.262756.93670@z14g2000cwz.googlegroups.com...
> Download Reflector and take a look at it yourself.  It will show the
> code in VB, C# or Delphi!
>
Author
7 Jul 2005 7:19 AM
DraguVaso
Hm wel ok, it's really nice, but I'm afraid it won't help me doing what I
want to do :-/ It uses functions that are private declared in the datagrid,
so I can't use them in my inherited datagrid. Anybody has a solution?

Show quoteHide quote
"DraguVaso" <pietercou***@hotmail.com> wrote in message
news:u4AbZJsgFHA.824@TK2MSFTNGP14.phx.gbl...
> Wow that's just a great tool!!!!!
> Thanks a lot!!! :-)
>
>
> "Chris Dunaway" <dunaw***@gmail.com> wrote in message
> news:1120672074.262756.93670@z14g2000cwz.googlegroups.com...
> > Download Reflector and take a look at it yourself.  It will show the
> > code in VB, C# or Delphi!
> >
>
>
Author
7 Jul 2005 3:14 PM
Ross Presser
On Thu, 7 Jul 2005 09:19:19 +0200, DraguVaso wrote:

> Hm wel ok, it's really nice, but I'm afraid it won't help me doing what I
> want to do :-/ It uses functions that are private declared in the datagrid,
> so I can't use them in my inherited datagrid. Anybody has a solution?

There's nothing preventing you from calling Mybase.OnPaint yourself:

Protected Overrides Sub OnPaint( _
  ByVal pe As System.Windows.Forms.PaintEventArgs)

    ' call the parent
    MyBase.OnPaint(pe)

    ' now do some more stuff

End Sub
Author
8 Jul 2005 7:13 AM
DraguVaso
I did it already like that, but the problem is that it's really not a nice
solution: It draws the 'normal' column headers each time, and after half a
second it draws my custom column headers. This happens each time the grid is
refreshed or when there is clicked on the column-headers...

Isn't there a way to prevent things ike that? For instance some function
that repaints the control in memory, and shows it when everything is
complete (and my custom column headers are already put before the
original)... Isn't there some kind of function like this that tells the
datagrid to wait to do the updates just until it has the permission?

Show quoteHide quote
"Ross Presser" <rpresser@NOSPAMgmail.com.invalid> wrote in message
news:swaqwyernm51.12doktr0uzzde$.dlg@40tude.net...
> On Thu, 7 Jul 2005 09:19:19 +0200, DraguVaso wrote:
>
> > Hm wel ok, it's really nice, but I'm afraid it won't help me doing what
I
> > want to do :-/ It uses functions that are private declared in the
datagrid,
> > so I can't use them in my inherited datagrid. Anybody has a solution?
>
> There's nothing preventing you from calling Mybase.OnPaint yourself:
>
> Protected Overrides Sub OnPaint( _
>   ByVal pe As System.Windows.Forms.PaintEventArgs)
>
>     ' call the parent
>     MyBase.OnPaint(pe)
>
>     ' now do some more stuff
>
> End Sub
Author
12 Jul 2005 7:31 AM
DraguVaso
Yessssssssssssss!!! I found it myself:
I call the base-class and than draw my custom functions in my
OnPaint-override. But this give me some stupid flickering, and always showed
a fraction of a second the old column-heaeders. But by using DoubleBuffer
and AllPaintingInWmPaint this problem is solved!! really great!!!! :-)

Public Sub EnableDoubleBuffering()
   ' Set the value of the double-buffering style bits to true.
   Me.SetStyle(ControlStyles.DoubleBuffer _
     Or ControlStyles.UserPaint _
     Or ControlStyles.AllPaintingInWmPaint, _
     True)
   Me.UpdateStyles()
End Sub




Show quoteHide quote
"DraguVaso" <pietercou***@hotmail.com> wrote in message
news:uZu2y6hgFHA.1284@TK2MSFTNGP14.phx.gbl...
> Hi,
>
> I want to override the MyBase.OnPaint(ByVal pe As
> System.Windows.Forms.PaintEventArgs) of the DataGrid, to have some custom
> property's designed (other column headers etc).
>
> The problem is that I don't know the content of the original
MyBase.OnPaint,
> so I don't know what I need to put in my overriden Sub. does anybody knows
> the content of it? Or is there a way to figure it out? Maybe somewhere in
> the pe-argument?
>
> Any help would be really appreciated!
>
> thanks a lot,
>
> Pieter Coucke
>
>

Bookmark and Share