类目识别功能 多选功能优化 微信上货优化 微信客服信息识别优化等

This commit is contained in:
wule committed 2026-02-04 11:59:58 +08:00
1 parent c27063d704
commit a2a6719a99
31 files changed
+2223 -750

No files matched your search

+41 -19
View File
@@ -9,6 +9,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.Extension;
namespace TemuKJD.UserComponent
{
@@ -46,19 +47,32 @@ namespace TemuKJD.UserComponent
ControlStyles.AllPaintingInWmPaint, true);
UpdateStyles();
this.Text = DefaultText;
this.DropDownWidth = 1;
this.DropDownHeight = 1;
this.DropDown += UcComboBoxMutiSelect_DropDown;
//this.DropDownClosed += UcComboBoxMutiSelect_DropDownClosed;
this.DropDownClosed += UcComboBoxMutiSelect_DropDownClosed;
}
private void UcComboBoxMutiSelect_DropDownClosed(object sender, EventArgs e)
{
if (checkedListBox != null)
checkedListBox.Visible = false;
{
var parentForm = this.FindForm();
Point mousePosition = parentForm.PointToClient(Cursor.Position);
Point relativeLocation = checkedListBox.GetRelativePosition();
if (mousePosition.X < relativeLocation.X || mousePosition.X > relativeLocation.X + checkedListBox.Width ||
mousePosition.Y < relativeLocation.Y || mousePosition.Y > relativeLocation.Y + checkedListBox.Height)
{
checkedListBox.Visible = false;
}
}
}
private void UcComboBoxMutiSelect_DropDown(object sender, EventArgs e)
{
this.DropDownHeight = 1;
var parentForm = this.FindForm();
if (checkedListBox == null)
{
@@ -69,21 +83,9 @@ namespace TemuKJD.UserComponent
checkedListBox.MouseLeave += checkedListBox_MouseLeave;
checkedListBox.MouseEnter += CheckedListBox_MouseEnter;
checkedListBox.MouseMove += CheckedListBox_MouseMove;
//checkedListBox.MouseUp += new MouseEventHandler(this.checkedListBox_MouseUp);
//checkedListBox.MouseUp += new MouseEventHandler(checkedListBox_MouseUp);
Point point = new Point();
point.X = this.Left;
point.Y = this.Top + this.Height;
var parentForm = this.Parent;
while (!(parentForm is Form))
{
point.X += parentForm.Left;
point.Y += parentForm.Top;
parentForm = parentForm.Parent;
}
parentForm.Controls.Add(checkedListBox);
checkedListBox.Location = point;
checkedListBox.Size = new Size(Math.Max(80, this.Width), 100);
}
string str1 = string.Join(",", this.Items.Cast<object>().Select(o => o.ParseToString()));
@@ -92,14 +94,34 @@ namespace TemuKJD.UserComponent
{
checkedListBox.Items.Clear();
foreach (var item in this.Items)
{
checkedListBox.Items.Add(item.ParseToString(), true);
{
checkedListBox.Items.Add(item.ParseToString(), true);
}
}
for (int index = 0; index < checkedListBox.Items.Count; index++)
{
var item = checkedListBox.Items[index];
if (this.Text == "全部" || this.Text.Split(new string[] { ";", ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries).Contains(item.ParseToString()))
checkedListBox.SetItemChecked(index, true);
else
checkedListBox.SetItemChecked(index, false);
}
this.FindForm().ActiveControl = checkedListBox;
checkedListBox.SendToBack();
checkedListBox.Visible = true;
// 确定弹出列表框的大小和位置
checkedListBox.Size = new Size(Math.Max(80, this.Width), Math.Min(300, checkedListBox.PreferredHeight));
Point relativeLocation = this.GetRelativePosition();
if (parentForm.Height - relativeLocation.Y >= this.Height + checkedListBox.Size.Height + 20)
relativeLocation = new Point(relativeLocation.X, relativeLocation.Y + this.Height);
else
relativeLocation = new Point(relativeLocation.X, relativeLocation.Y - checkedListBox.Size.Height);
checkedListBox.Location = relativeLocation;
checkedListBox.BringToFront();
//parentForm.ActiveControl = checkedListBox;
//checkedListBox.Focus();
}
private void CheckedListBox_MouseMove(object sender, MouseEventArgs e)