微信app采集

This commit is contained in:
wule committed 2026-03-26 21:34:59 +08:00
1 parent 52220daa8b
commit 2f61dc1cdd
67 files changed
+6197 -1118

No files matched your search

+34 -11
View File
@@ -18,7 +18,18 @@ namespace TemuKJD.UserComponent
//private bool _IsMultiSelect;
//public bool IsMultiSelect { get => _IsMultiSelect; set => _IsMultiSelect = value; }
public string DefaultText { get; set; } = "全部";
string defaultText = "全部";
[Browsable(true), Description("默认文本"), Category("自定义分组")]
public string DefaultText
{
get { return defaultText; }
set
{
defaultText = value;
this.Text = defaultText;
this.Invalidate();
}
}
public List<object> SelectItems
{
@@ -197,15 +208,27 @@ namespace TemuKJD.UserComponent
if (str1 != str2)
{
checkedListBox.Items.Clear();
if (Items.Count > 0)
checkedListBox.ItemCheck -= checkedListBox_ItemCheck;
foreach (var item in this.Items)
{
checkedListBox.Items.Add(item.ParseToString(), true);
{
if (Items[Items.Count - 1] == item)
checkedListBox.ItemCheck += checkedListBox_ItemCheck;
checkedListBox.Items.Add(item.ParseToString(), true);
}
}
// 防止一起设置每次都要重新拼接字符串
if (checkedListBox.Items.Count > 0)
checkedListBox.ItemCheck -= checkedListBox_ItemCheck;
for (int index = 0; index < checkedListBox.Items.Count; index++)
{
if (index == checkedListBox.Items.Count - 1)
checkedListBox.ItemCheck += checkedListBox_ItemCheck;
var item = checkedListBox.Items[index];
if (this.Text == DefaultText || this.Text.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).Contains(item.ParseToString()))
if (this.Text == DefaultText || this.Text.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList().Contains(item.ParseToString()))
checkedListBox.SetItemChecked(index, true);
else
checkedListBox.SetItemChecked(index, false);
@@ -213,12 +236,12 @@ namespace TemuKJD.UserComponent
// 计算宽度
int maxItemWidth = 0;
for (int index = 0; index < checkedListBox.Items.Count; index++)
{
var wth = TextRenderer.MeasureText(checkedListBox.Items[index].ToString(), checkedListBox.Font).Width + 20;
if (wth > maxItemWidth)
maxItemWidth = wth;
}
//for (int index = 0; index < checkedListBox.Items.Count; index++)
//{
// var wth = TextRenderer.MeasureText(checkedListBox.Items[index].ToString(), checkedListBox.Font).Width + 20;
// if (wth > maxItemWidth)
// maxItemWidth = wth;
//}
checkedListBox.SendToBack();
checkedListBox.Visible = true;
@@ -282,7 +305,7 @@ namespace TemuKJD.UserComponent
str += $"{checkedListBox.Items[i].ParseToString()};";
}
}
this.Text = str;
this.Text = str.Trim(';');
string str1 = string.Join(";", this.Items.Cast<object>().Select(o => o.ParseToString()));