コード例 #1
0
ファイル: ListValues.cs プロジェクト: wladengine/BaseFormsLib
        public ListValues(MultySelectList owner, IDictionary <string, string> dctSource, IList <string> lstSelected)
        {
            InitializeComponent();

            _owner       = owner;
            _lstSelected = lstSelected;

            if (dctSource == null || dctSource.Count == 0)
            {
                return;
            }

            chbValues.DataSource    = new BindingSource(dctSource, null);
            chbValues.ValueMember   = "Key";
            chbValues.DisplayMember = "Value";

            for (int i = 0; i < chbValues.Items.Count; i++)
            {
                KeyValuePair <string, string> item = (KeyValuePair <string, string>)chbValues.Items[i];
                if (_lstSelected.Contains(item.Key))
                {
                    chbValues.SetItemChecked(i, true);
                }
            }

            chbValues.Focus();
        }
コード例 #2
0
ファイル: ListValues.cs プロジェクト: wladengine/BaseFormsLib
        public ListValues(MultySelectList owner, IDictionary<string, string> dctSource, IList<string> lstSelected)
        {
            InitializeComponent();

            _owner = owner;
            _lstSelected = lstSelected;

            if (dctSource == null || dctSource.Count == 0)
                return;

            chbValues.DataSource = new BindingSource(dctSource, null);
            chbValues.ValueMember = "Key";
            chbValues.DisplayMember = "Value";

            for (int i = 0; i < chbValues.Items.Count; i++)
            {
                KeyValuePair<string, string> item = (KeyValuePair<string, string>)chbValues.Items[i];
                if(_lstSelected.Contains(item.Key))
                    chbValues.SetItemChecked(i, true);
            }

            chbValues.Focus();
        }