drawing custom datagridview with header RRS feed

  • Question

  • User-1670815875 posted


    I have a datagridview that I would like to draw a small panel over the top of it with a title and I would like to combine the 2 into a custom control. I do not want to make it a usercontrol because I dont want to have to access the datagridview properties 2 levels deep such as customcontrol.datagridview1.Rows... I would like to make the control inherit from the datagridview class and then add a panel to draw over the top of it so then I would be able to access the datagridview properties at 1 level: datagridviewwithheader.Rows....

    Here is the dilemma:

    When I try to draw the control by overriding the onpaint and making the region larger I cannot get the datagridview to shift down in the region so as to add the header to the top of it. Any ideas on how to accomplish this?

    Thanks in Advance

    Wednesday, February 4, 2009 1:35 PM