0

I am trying to find a solution to this issue since 10 days and nothing.

I need to be able to create a Checkedlistbox form and to set "OwnerDrawFixed" to that, but it always stays at "Normal".

Why?

$checkedListBox = New-Object System.Windows.Forms.CheckedListBox

$checkedListBox.DrawMode = [System.Windows.Forms.DrawMode]::OwnerDrawFixed

$checkedListBox.DrawMode

Normal

The reason is ask that is because I really want to find a solution to my issue :

Add checkboxes to Listbox with Powershell Windows Forms

Thanks 1000x in advance if you have ideas.

Community
  • 1
  • 1
expirat001
  • 2,125
  • 4
  • 30
  • 40

1 Answers1

0

This has nothing to do with powershell. Simply CheckedListBox doesn't supports DrawMode property.

It exist there just because it is inherited from its base class. A classic example of LSP violation.

Sriram Sakthivel
  • 72,067
  • 7
  • 111
  • 189
  • Thanks for your reply. So, there is no way to have a Winform with checkboxes and colour some specific individual items? The Listbox colours items but no checkboxes, and the CheckedListbox doesn't colour items but with checkboxes. – expirat001 Dec 18 '14 at 08:53
  • @expirat001 May be [this](http://stackoverflow.com/questions/18725111/can-i-use-a-drawitem-event-handler-with-a-checkedlistbox) can help you. – Sriram Sakthivel Dec 18 '14 at 08:56