StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Yuichi  
#1 Posted : Monday, June 17, 2019 10:22:24 AM(UTC)
Yuichi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 9/13/2018(UTC)
Posts: 54
Poland

Thanks: 18 times
Was thanked: 16 time(s) in 11 post(s)
Hi
Maybe someone will use it.

Download link:
CheckedListBoxWindow

And how to use it:

Code:
var form = new CheckedListBoxFormLibrary().GetForm();

form.Text = "new title";
form.label1.Text = "new name";
form.button1.Text = "Ok";
form.button2.Text = "Cancel";
form.button3.Text = "Toggle Selection";
form.checkedListBox1.Items.Add("A");
form.checkedListBox1.Items.Add("B");
form.checkedListBox1.Items.Add("C");

// Changes the selection mode from single click to double-click (default is single click)
//form.checkedListBox1.CheckOnClick = false;

var result = form.ShowDialog();

if(result.ToString() == "Cancel") {
    sp.MessageBox("You clicked Cancel", "Cancel");

} else if(result.ToString() == "OK") {

    var allItemsCount = form.checkedListBox1.Items.Count; // how many items is in checkedListBox1
    var selItemsCount = form.checkedListBox1.CheckedItems.Count; // how many items are selected

    sp.MessageBox("All items: " + allItemsCount + "\nAll selected items: " + selItemsCount, "OK");

    // SHOW INDEX, TITLE AND STATE OF ONLY SELECTED ITEMS
    var itemChecked = form.checkedListBox1.CheckedItems;
    var indexChecked = form.checkedListBox1.CheckedIndices;
    for (i = 0; i < itemChecked.Count; i++) {
        sp.MessageBox("Index: " + indexChecked[i] + "\nTitle: " + itemChecked[i] + "\nState: " + form.checkedListBox1.GetItemCheckState(indexChecked[i]).ToString(), "SEL ITEMS i=" + i);
    }

    // SHOW INDEX, TITLE AND STATE OF ALL ITEMS
    var item = form.checkedListBox1.Items;
    for (i = 0; i < form.checkedListBox1.Items.Count; i++) {
        // index number is the same as "i"
        sp.MessageBox("Index: " + i + "\nTitle: " + item[i] + "\nState: " + form.checkedListBox1.GetItemCheckState(i).ToString(), "ALL ITEMS i=" + i);
    }
}

Edited by user Monday, June 17, 2019 8:47:20 PM(UTC)  | Reason: An updated dll file, if all items are unchecked, the OK button will be disabled

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.