Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. EditingPanel Erasing Top Cell Border

EditingPanel Erasing Top Cell Border

Scheduled Pinned Locked Moved Windows Forms
cssgraphicstutorialquestion
2 Posts 1 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mark Regal
    wrote on last edited by
    #1

    This maybe academic but here goes anyway... I'm drawing custom borders for a datagridview in the datagridview's paint event, the one in a Windows form. That works fine until I edit a cell. When I edit a cell, the top and left grid borders (which are drawn by me in the grid's paint event) are over-layed by the EditingPanel control of the datagridview class. So the borders disappears and the cell looks like it has only two borders...bottom...and right. I subsequently created a custom column and cell template for the grid but no matter what I've tried so far, I can't get to the event that's overwriting my borders to either have it paint the missing borders themselves, or stop it from overwriting the ones that I'm drawing. It would seem that this type of task needs to be accomplished all the time and I just don't know how...so I'm totally missing the boat on this one. Would someone please let me in on the secret of how to (the proper procedures) for painting custom borders around the datagridview cell I'm editing? The borders should be in alignment with the grid's boarders and have the ability to be drawn in different colors. Please advise and thanks!!! Mark

    M 1 Reply Last reply
    0
    • M Mark Regal

      This maybe academic but here goes anyway... I'm drawing custom borders for a datagridview in the datagridview's paint event, the one in a Windows form. That works fine until I edit a cell. When I edit a cell, the top and left grid borders (which are drawn by me in the grid's paint event) are over-layed by the EditingPanel control of the datagridview class. So the borders disappears and the cell looks like it has only two borders...bottom...and right. I subsequently created a custom column and cell template for the grid but no matter what I've tried so far, I can't get to the event that's overwriting my borders to either have it paint the missing borders themselves, or stop it from overwriting the ones that I'm drawing. It would seem that this type of task needs to be accomplished all the time and I just don't know how...so I'm totally missing the boat on this one. Would someone please let me in on the secret of how to (the proper procedures) for painting custom borders around the datagridview cell I'm editing? The borders should be in alignment with the grid's boarders and have the ability to be drawn in different colors. Please advise and thanks!!! Mark

      M Offline
      M Offline
      Mark Regal
      wrote on last edited by
      #2

      I guess a few hours of sleep help sometimes...I think that this is the way... Private Sub Grid_CellPainting(sender As Object, e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles Grid.CellPainting Try 'Paint the cell if the edit control is visible If Grid.EditingControl IsNot Nothing Then Dim g As Graphics = Graphics.FromHwnd(Grid.EditingPanel.Handle) g.DrawRectangle(Pens.Red, Grid.EditingPanel.ClientRectangle) g.Dispose() End If Catch ex As Exception Debug.print(ex.Message) End Try End Sub

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups