private void LoadItems() { fpnlList.Controls.Clear(); string currentPath = Assembly.GetExecutingAssembly().Location; string dir = new FileInfo(currentPath).DirectoryName; dir = dir + "\\ShopItems"; if (Directory.Exists(dir)) { foreach (string path in Directory.GetFiles(dir, "*.info", SearchOption.TopDirectoryOnly)) { string iid, name, price, imgPath, imgUrl; GetItem(path, out iid, out name, out price, out imgPath, out imgUrl); CtrlItem item = new CtrlItem(); item.LoadItem(iid, name, price, imgPath, imgUrl); fpnlList.Controls.Add(item); } } lblTitle.Text = string.Format("当前商品总数: {0} 个", fpnlList.Controls.Count); }