| CheckListBox based on ListBox that supports ReadOnly |
| Written by H. Tony |
| Friday, 30 January 2009 16:00 |
IntroductionThis is based on article at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2384558&SiteID=1&mode=1 where I extended the code provided by Zhi-Xin Ye in the post to create a CheckListBox that supports ReadOnly. Unlike CheckedListBox control which can only be Disabled. Using the codeDemo Project contains the code as following:
private void Form1_Load(object sender, EventArgs e)
{
//ReadOnly CheckListBox
checkListBox1.BackColor = Color.FromKnownColor(KnownColor.ControlLight);
checkListBox1.SelectionMode = SelectionMode.None;
CheckBox[] boxes = new CheckBox[100];
for (int i = 0; i < 100; i++)
{
CheckBox box = new CheckBox();
box.Checked = true;
box.Enabled = false;
box.Text = "box" + i.ToString();
boxes[i] = box;
}
checkListBox1.AddCheckBoxes(boxes);
//Normal CheckListBox
boxes = new CheckBox[100];
for (int i = 0; i < 100; i++)
{
CheckBox box = new CheckBox();
box.Text = "box" + i.ToString();
boxes[i] = box;
}
checkListBox2.AddCheckBoxes(boxes);
}
Points of Interest
Like I mentioned, mouse wheel scroll is quite slow and there"s flickering when I use scrollbar. This is just a start, hopefully I will be able to make it better in future.
History
1.0 Created
Something wrong with this article? Report it
Set as favorite
Bookmark
Email This
Hits: 159 0 Comments
Write comment
You must be logged in to a comment. Please register if you do not have an account yet.
|
| Last Updated on Friday, 06 February 2009 16:00 |
Latest Articles
- AntiHisto
- Thumbnail images in PHP
- Online Dating Websites
- Hack to enforce the cache of an XmlDataSource to invalidate
- AutoSearch SELECT tag
- Nine ASP.NET Site Navigation Problem Solutions: Part 1
- Enhanced rich edit control
- CheckListBox based on ListBox that supports ReadOnly
- Introduction to COM - What It Is and How to Use It.
- Introduction to the Validation Application Block


