using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using static HTEXMark.QRCodeForm; namespace HTEXMark { public class KnowledgeUserControl : UserControl { public KnowledgeUserControl() { } public void InitializeTreeView(System.Windows.Forms.ListBox knowledgeListBox,List block) { foreach (var item in block) { // 将 TreeView 添加到 UserControl1 的 Controls 集合中 if (item.points.Count()>0) { knowledgeListBox.Name=item.name; foreach (var point in item.points) { this.BeginInvoke(new Action(() => { knowledgeListBox.Items.Add(point); })); } } } } } }