07/06/15 14:04:58
>>684
いいヒントもらえたのでちょっと強引にやってみました。
セルのボタンを表示したくないValueにはNothing そうじゃないばあいNothing以外を入れて
CellPaintingイベントで
If e.RowIndex >= 0 AndAlso e.ColumnIndex >= 0 AndAlso dgvList.Columns(e.ColumnIndex).Name Is 該当のカラム Then
Dim temp As DataGridViewCell = dgvList.Rows(e.RowIndex).Cells(e.ColumnIndex)
If temp.Value Is Nothing Then
Dim TempPoint As New Point(e.CellBounds.X + e.CellBounds.Width - 1, e.CellBounds.Y)
Dim TempPoint2 As New Point(e.CellBounds.X + e.CellBounds.Width - 1, e.CellBounds.Y + e.CellBounds.Height)
e.Graphics.FillRectangle(New SolidBrush(Color.White), e.CellBounds)
e.Graphics.DrawLine(New Pen(SystemColors.ControlDark), TempPoint, TempPoint2)
e.Handled = True
End If
End If
ボタンを表示したくない時は自分で塗りつぶして線も描画し、表示したい時はコントロール任せ
こんな感じでとりあえずいけそうかなぁと
助かりました~