By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,928 Members | 1,810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,928 IT Pros & Developers. It's quick & easy.

CheckedListBox disabled, how to scroll?

P: n/a
Hi,

A simple, but yet frustrating issue. I am using CheckedListBox control on a
Windows Form in a C# application. When I disable CheckedListBox, the vertical
toolbar is becoming disabled also. So the user has no way to scroll control
up and down to see what items are checked and what are not.

Is it a way to disable control (so the user wouldn’t be able change checked
items), but leave the control scrollable?

Can be done by overriding WndProc and canceling some messages there?

Thanks,
Victor
Jun 27 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Victor" <Vi****@discussions.microsoft.comwrote:
Is it a way to disable [CheckedListBox] (so the user wouldn’t be able
change checked items), but leave the control scrollable?
You probably could use WndProc, but here's a quick hack that does it
more simply:

private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs
e)
{
e.NewValue = e.CurrentValue;
}

Eq.
Jun 27 '08 #2

P: n/a
I found a solution. Overriding OnItemCheck works nicely.
Thanks.

bool disableCheckBoxes = true;

protected override void OnItemCheck(ItemCheckEventArgs ice)
{
if (disableCheckBoxes)
ice.NewValue = ice.CurrentValue;

base.OnItemCheck(ice);
}

"Victor" wrote:
Hi,

A simple, but yet frustrating issue. I am using CheckedListBox control on a
Windows Form in a C# application. When I disable CheckedListBox, the vertical
toolbar is becoming disabled also. So the user has no way to scroll control
up and down to see what items are checked and what are not.

Is it a way to disable control (so the user wouldn’t be able change checked
items), but leave the control scrollable?

Can be done by overriding WndProc and canceling some messages there?

Thanks,
Victor
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.