DataGridView not raising CellPainting event

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kulabhishek
    New Member
    • Dec 2008
    • 26

    DataGridView not raising CellPainting event

    Hello all,

    I am using DataGridView in my user control and its CellPainting event in C#. I have some merged cells in my control.
    When I drag & drop my control in other application, the LAST ROW of the DataGridView is not getting painted. Rest of the rows and columns in those rows are getting painted properly.
    Actually problem here is DataGridView is not raising CellPainting event for that last row. The rest of the things like DataSet & DataTable are there getting updated correctly, but last row is not getting painted.
    Even when i debugged the app, the break point did not hit for
    e.RowIndex == 16.

    Can anyone please help me with this....

    Thanks in advance
    Abhishek
  • RedSon
    Recognized Expert Expert
    • Jan 2007
    • 4980

    #2
    It'd probably help more if you posted your code.

    Comment

    • vekipeki
      Recognized Expert New Member
      • Nov 2007
      • 229

      #3
      When you say you have some "merged cells", I presume it means you are handling the CellPainting event and then drawing them yourself to look merged? Note that since these cells are internally not merged, DataGridView will only raise the event if it thinks it should draw a specific cell, not a range of cells.

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Originally posted by kulabhishek
        Even when i debugged the app, the break point did not hit for
        e.RowIndex == 16.
        and you are sure there are 17 rows in your object?

        Comment

        • kulabhishek
          New Member
          • Dec 2008
          • 26

          #5
          Ya there are 17 rows in object.

          The problem is not yet solved, but now i removed the DataGridView and painting my control in paint event only.

          Thanks for all your help

          Regards
          Abhishek

          Comment

          Working...