private void getDetailInfo(string fileName, bool teamB = false) { string jsonFileName = lolReplayPath + "\\db\\" + fileName + ".json"; int row; int step = 0, anotherCounter = 0; if (teamB) { step = 7; //此处是根据你们代码理解计算出来的,我也不知道为什么 Team B的初始化时,是row = 8 anotherCounter = 5; } using (StreamReader r = new StreamReader(jsonFileName)) { string json = r.ReadToEnd(); List <Record> perTeam = JsonConvert.DeserializeObject <List <Record> >(json); for (row = (1 + step); row < (6 + step); row++) { /*String roleName = perTeam.player_list[row - (1+step)].role + ".png"; * Debug.Write(roleName); * ListViewRight.AddIconToSubitem(row, 1, SearchImageFromList(roleName));*/ string ChampionName = championtable.getNameFromID(perTeam[row - (1 + step) + anotherCounter].ChampionId); ListViewRight.AddIconToSubitem(row, 1, SearchImageFromList(ChampionName + ".png")); ListViewRight.Items[row].SubItems[2].Text = perTeam[row - (1 + step) + anotherCounter].Name + '\n' + ChampionName; ListViewRight.Items[row].SubItems[3].Text = perTeam[row - (1 + step) + anotherCounter].KDA; for (int j = 0; j < 6; j++) { //ListViewRight.AddIconToSubitem(row, 5 + j, SearchImageFromList(perTeam[row - (1 + step)].Item0 + ".png")); } ListViewRight.AddIconToSubitem(row, 5, SearchImageFromList(perTeam[row - (1 + step) + anotherCounter].Item0 + ".png")); ListViewRight.AddIconToSubitem(row, 6, SearchImageFromList(perTeam[row - (1 + step) + anotherCounter].Item1 + ".png")); ListViewRight.AddIconToSubitem(row, 7, SearchImageFromList(perTeam[row - (1 + step) + anotherCounter].Item2 + ".png")); ListViewRight.AddIconToSubitem(row, 8, SearchImageFromList(perTeam[row - (1 + step) + anotherCounter].Item3 + ".png")); ListViewRight.AddIconToSubitem(row, 9, SearchImageFromList(perTeam[row - (1 + step) + anotherCounter].Item4 + ".png")); ListViewRight.AddIconToSubitem(row, 10, SearchImageFromList(perTeam[row - (1 + step) + anotherCounter].Item5 + ".png")); ListViewRight.AddIconToSubitem(row, 11, SearchImageFromList(perTeam[row - (1 + step) + anotherCounter].Item6 + ".png")); ListViewRight.Items[row].SubItems[13].Text = perTeam[row - (1 + step) + anotherCounter].GoldEarned.ToString() + 'k'; ListViewRight.Items[row].SubItems[14].Text = perTeam[row - (1 + step) + anotherCounter].MinionsKilled.ToString(); //ListViewRight.AddToSubitem(row, 1, SearchImageFromList(roleName)); } } }
private void Form1_Load(object sender, EventArgs e) { #region ListViewLeft lvwBooks.SmallImageList = Lol_heros; lvwBooks.ShowSubItemIcons(true); // Make the column headers. lvwBooks.MakeColumnHeaders( "Hero1", 55, HorizontalAlignment.Right, "Hero2", 55, HorizontalAlignment.Left, "Hero3", 55, HorizontalAlignment.Left, "Hero4", 55, HorizontalAlignment.Left, "Hero5", 55, HorizontalAlignment.Right); /*lvwBooks.Groups.Add(new ListViewGroup("1", HorizontalAlignment.Left)); * lvwBooks.Groups.Add(new ListViewGroup("2", HorizontalAlignment.Left)); * lvwBooks.Groups.Add(new ListViewGroup("3", HorizontalAlignment.Left)); * * // Start with the last View (Details) selected. * lvwBooks.SmallImageList = Lol_heros; * lvwBooks.ShowSubItemIcons(true); * // Make the column headers. * lvwBooks.MakeColumnHeaders( * "Hero1", 55, HorizontalAlignment.Right, * "Hero2", 55, HorizontalAlignment.Left, * "Hero3", 55, HorizontalAlignment.Left, * "Hero4", 55, HorizontalAlignment.Left, * "Hero5", 55, HorizontalAlignment.Right); * * // Add data rows. * lvwBooks.AddRow("", "", "", "", ""); * lvwBooks.AddRow("", "", "", "", ""); * lvwBooks.AddRow("", "", "", "", ""); // empty * lvwBooks.AddRow("", "", "", "", ""); * lvwBooks.AddRow("", "", "", "", ""); * lvwBooks.AddRow("", "", "", "", ""); // empty * * int k = 0; * // Add icons to the sub-items. * for (int r = 0; r < lvwBooks.Items.Count; r++) * { * // Set the main item's image index. * lvwBooks.Items[r].ImageIndex = r; * lvwBooks.Items[r].ImageKey = "Annie.png"; * lvwBooks.Items[r].Group = lvwBooks.Groups[k]; * // Set the sub-item indices. * for (int c = 1; c < lvwBooks.Columns.Count; c++) * { * lvwBooks.AddIconToSubitem(r, c, c); * } * * if (r % 2 == 1) k++; * }*/ #endregion #region ListViewRight ControlTrans(ListViewRight, ListViewRight.BackgroundImage); ListViewRight.SmallImageList = Lol_heros; ListViewRight.ShowSubItemIcons(true); // Make the column headers. // header, 設定欄位 ListViewRight.MakeColumnHeaders( "Empty", 15, HorizontalAlignment.Right, "HeroPic", 50, HorizontalAlignment.Right, "Name", 155, HorizontalAlignment.Left, "Killed", 65, HorizontalAlignment.Center, "Empty", 15, HorizontalAlignment.Right, "Accessories1", 47, HorizontalAlignment.Center, "Accessories2", 47, HorizontalAlignment.Center, "Accessories3", 47, HorizontalAlignment.Center, "Accessories4", 47, HorizontalAlignment.Center, "Accessories5", 47, HorizontalAlignment.Center, "Accessories6", 47, HorizontalAlignment.Center, "Accessories7", 47, HorizontalAlignment.Center, "Empty", 10, HorizontalAlignment.Right, "Money", 60, HorizontalAlignment.Left, "Value", 40, HorizontalAlignment.Left); // 新增資料部分, empty為強制換行(符合背景格式) ListViewRight.AddRow("", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); // empty ListViewRight.AddRow("", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); // empty ListViewRight.AddRow("", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); // empty ListViewRight.AddRow("", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); // empty ListViewRight.AddRow("", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); // empty ListViewRight.AddRow("", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); // empty ListViewRight.AddRow("", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); // empty ListViewRight.AddRow("", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); // empty ListViewRight.AddRow("", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); // empty ListViewRight.AddRow("", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); // empty ListViewRight.AddRow("", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); // empty ListViewRight.AddRow("", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); // empty ListViewRight.AddRow("", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); // empty for (int i = 0; i < 13; i++) { ListViewRight.Items[i].ImageIndex = -1; } #endregion }