資源簡介
C# 下拉框多選
代碼片段和文件信息
/**************************************************
*????Copyright?(c)?ZJCSoft
*????All?rights?reserved.
*
*????文件名稱:baseComboBox
*????描????述:自定義的下拉多選控件
*
*????創(chuàng)?建?人:?西域雪狼
*????創(chuàng)建日期:?2021-06-04
*????初始版本:?1.0
*
*????修?改?人:?
*????修改日期:?
*????當(dāng)前版本:?
**************************************************/
using?System;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Windows.Forms;
using?System.ComponentModel;
using?System.Collections.Generic;
namespace?ComboBoxTest
{
????public?class?baseComboBox?:?ComboBox
????{
????????///?
????????///?構(gòu)造函數(shù)
????????///?
????????public?baseComboBox()
????????{
????????????DropDownstyle?=?ComboBoxstyle.DropDownList;
????????????boxControl.AfterSelect?+=?boxControl_AfterSelect;
????????????boxControl.Hide();
????????}
????????#region?參數(shù)定義
????????private?ComboBoxItemControl?boxControl?=?new?ComboBoxItemControl();
????????private?List?_selectedValues?=?new?List();
????????private?List?_selectedTexts?=?new?List();
????????private?int?_selectedIndex?=?-1;
????????ToolTip?tip?=?new?ToolTip();
????????#endregion
????????#region?控件屬性
????????[Description(“獲取或設(shè)置要在列表的下拉部分中顯示的最大項數(shù)。“)]
????????public?new?int?MaxDropDownItems?{?get?{?return?boxControl.MaxDropDownItems;?}?set?{?boxControl.MaxDropDownItems?=?value;?}?}
????????[Description(“獲取或設(shè)置一個值,該值指示是否顯示包含列標(biāo)題的行。“)]
????????public?bool?ColumnHeaderVisible?{?get?{?return?boxControl.ColumnHeaderVisible;?}?set?{?boxControl.ColumnHeaderVisible?=?value;?}?}
????????[Description(“獲取或設(shè)置一個值,該值指示是否顯示包含行標(biāo)題的列。“)]
????????public?bool?RowHeaderVisible?{?get?{?return?boxControl.RowHeaderVisible;?}?set?{?boxControl.RowHeaderVisible?=?value;?}?}
????????[Description(“獲取或設(shè)置一個值,指示是否允許多選“)]
????????public?bool?MultiSelect?{?get?{?return?boxControl.MultiSelect;?}?set?{?boxControl.MultiSelect?=?value;?}?}
????????[Description(“獲取或設(shè)置要用作中的各項的實際值的屬性路徑?System.Windows.Forms.ListControl。“)]
????????public?new?string?ValueMember?{?get?{?return?boxControl.ValueMember;?}?set?{?boxControl.ValueMember?=?value;?}?}
????????[Description(“獲取或設(shè)置該屬性以顯示此?System.Windows.Forms.ListControl。“)]
????????public?new?string?DisplayMember?{?get?{?return?boxControl.DisplayMember;?}?set?{?boxControl.DisplayMember?=?value;?}?}
????????[Description(“獲取或設(shè)置已多選的值“)?Browsable(false)]
????????public?List?SelectedValues
????????{
????????????get?{?return?_selectedValues;?}
????????????set
????????????{
????????????????var?newvalue?=?value????new?List();
????????????????_selectedValues?=?newvalue;
????????????????boxControl.SetSelectedValues(newvalue);
????????????????boxControl_AfterSelect(null?null);
????????????}
????????}
????????[Description(“獲取已選中的顯示內(nèi)容“)?Browsable(false)]
????????public?List?SelectedTexts?{?get?{?return?_selectedTexts;?}?}
????????[Description(“獲取或設(shè)置已選的值“)?Browsable(false)]
????????public?new?string?SelectedValue?{?get?{?return?SelectedVa
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????..A..H.?????34816??2021-06-04?16:21??ComboBoxTest\.vs\ComboBoxTest\v15\.suo
?????文件??????????0??2021-06-04?14:17??ComboBoxTest\.vs\ComboBoxTest\v15\Server\sqlite3\db.lock
?????文件?????602112??2021-06-04?15:45??ComboBoxTest\.vs\ComboBoxTest\v15\Server\sqlite3\storage.ide
?????文件??????32768??2021-06-04?14:17??ComboBoxTest\.vs\ComboBoxTest\v15\Server\sqlite3\storage.ide-shm
?????文件????4136512??2021-06-04?15:57??ComboBoxTest\.vs\ComboBoxTest\v15\Server\sqlite3\storage.ide-wal
????..A..H.?????88064??2021-06-26?09:37??ComboBoxTest\.vs\ComboBoxTest\v16\.suo
?????文件????????189??2021-06-04?14:17??ComboBoxTest\ComboBoxTest\App.config
?????文件???????8839??2021-06-25?15:49??ComboBoxTest\ComboBoxTest\ba
?????文件??????34816??2021-06-26?09:36??ComboBoxTest\ComboBoxTest\bin\Debug\ComboBoxTest.exe
?????文件????????189??2021-06-04?14:17??ComboBoxTest\ComboBoxTest\bin\Debug\ComboBoxTest.exe.config
?????文件??????83456??2021-06-26?09:36??ComboBoxTest\ComboBoxTest\bin\Debug\ComboBoxTest.pdb
?????文件??????13106??2021-06-26?09:31??ComboBoxTest\ComboBoxTest\ComboBoxItemControl.cs
?????文件???????8792??2021-06-25?16:12??ComboBoxTest\ComboBoxTest\ComboBoxItemControl.Designer.cs
?????文件???????5817??2021-06-25?16:12??ComboBoxTest\ComboBoxTest\ComboBoxItemControl.resx
?????文件???????4094??2021-06-04?15:23??ComboBoxTest\ComboBoxTest\ComboBoxTest.csproj
?????文件????????214??2021-06-24?16:30??ComboBoxTest\ComboBoxTest\obj\Debug\.NETfr
?????文件????????180??2021-06-25?16:12??ComboBoxTest\ComboBoxTest\obj\Debug\ComboBoxTest.ComboBoxItemControl.resources
?????文件?????????42??2021-06-24?16:31??ComboBoxTest\ComboBoxTest\obj\Debug\ComboBoxTest.csproj.CoreCompileInputs.cache
?????文件???????1969??2021-06-25?17:06??ComboBoxTest\ComboBoxTest\obj\Debug\ComboBoxTest.csproj.FileListAbsolute.txt
?????文件???????1087??2021-06-26?09:32??ComboBoxTest\ComboBoxTest\obj\Debug\ComboBoxTest.csproj.GenerateResource.cache
?????文件???????2387??2021-06-26?09:36??ComboBoxTest\ComboBoxTest\obj\Debug\ComboBoxTest.csprojAssemblyReference.cache
?????文件??????34816??2021-06-26?09:36??ComboBoxTest\ComboBoxTest\obj\Debug\ComboBoxTest.exe
?????文件??????83456??2021-06-26?09:36??ComboBoxTest\ComboBoxTest\obj\Debug\ComboBoxTest.pdb
?????文件????????180??2021-06-04?16:21??ComboBoxTest\ComboBoxTest\obj\Debug\ComboBoxTest.Properties.Resources.resources
?????文件????????646??2021-06-26?09:32??ComboBoxTest\ComboBoxTest\obj\Debug\ComboBoxTest.TestForm.resources
?????文件??????28567??2021-06-04?15:57??ComboBoxTest\ComboBoxTest\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????7160??2021-06-04?14:56??ComboBoxTest\ComboBoxTest\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件??????????0??2021-06-04?14:17??ComboBoxTest\ComboBoxTest\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件??????????0??2021-06-04?14:17??ComboBoxTest\ComboBoxTest\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件??????????0??2021-06-04?14:17??ComboBoxTest\ComboBoxTest\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
............此處省略28個文件信息
評論
共有 條評論