VB.NET質問スレ (Part21)
at TECH
685:デフォルトの名無しさん
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
ボタンを表示したくない時は自分で塗りつぶして線も描画し、表示したい時はコントロール任せ
こんな感じでとりあえずいけそうかなぁと
助かりました〜
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5091日前に更新/282 KB
担当:undef