How do you disable an item in listview control in .net 3.5

前端 未结 5 669
渐次进展
渐次进展 2020-11-30 14:13

In .net 3.5 windows forms I have a listview with \"CheckBoxes\" = true. Is it possible to dim out or disable some items to prevent the user from checking the box?

5条回答
  •  感动是毒
    2020-11-30 14:30

    I took Hans Passant recommendation - good visual approach which in my case denotes un-actionable items. Here's a sample:

        'Select all attachements in case user wants to mask or pick and choose
        For i As Integer = 0 To lstView.Items.Count - 1
            If Not Scan.SupportedMasking.Contains(Path.GetExtension(lstView.Items(i).Text)) Then
                lstView.Items(i).ForeColor = SystemColors.GrayText
                lstView.Items(i).Text += " (No masking supported)"
                lstView.Items(i).BackColor = SystemColors.InactiveBorder
                lstView.Items(i).Selected = False
            Else
                lstView.Items(i).Selected = True
            End If
        Next i
    

提交回复
热议问题