private void DisplayTeams(List <LCGBSummoner>[] teams) { for (int i = 0; i < teams.Length; i++) { Panel panel = (Panel)this.Controls.Find("pT" + i, false)[0]; foreach (Control c in panel.Controls) { if (c.Name.Contains("Ring") && c is OvalPictureBox) { c.Visible = true; } for (int j = 0; j < teams[i].Count; j++) { Label lName = (Label)panel.Controls.Find("T" + i + "P" + j + "Name", false)[0]; Label lRank = (Label)panel.Controls.Find("T" + i + "P" + j + "Rank", false)[0]; OvalPictureBox opbIcon = (OvalPictureBox)panel.Controls.Find("T" + i + "P" + j + "Icon", false)[0]; PictureBox pbRankPic = (PictureBox)panel.Controls.Find("T" + i + "P" + j + "RankPic", false)[0]; lName.Text = teams[i][j].nickname; lName.Visible = true; lRank.Text = teams[i][j].rank; lRank.Visible = true; opbIcon.ImageLocation = teams[i][j].iconurl; opbIcon.Visible = true; pbRankPic.ImageLocation = teams[i][j].rankurl; } } } }
private void Icon_Click(object sender, EventArgs e) { OvalPictureBox icon = new OvalPictureBox(); icon.Size = (sender as OvalPictureBox).Size; icon.Image = (sender as OvalPictureBox).Image; icon.BackColor = (sender as OvalPictureBox).BackColor; icon.BackgroundImage = (sender as OvalPictureBox).BackgroundImage; icon.Tag = (sender as OvalPictureBox).Tag; icon.DoubleClick += Icon_DoubleClick; var a = NodeController.Get_Node_Selected(); if (a != null) { a.flowLayoutPanel1.Controls.Add(icon); } }
public static void ReadXmlFile(Control control, TextReader text) { using (XmlReader reader = XmlReader.Create(text)) { while (reader.Read()) { if (reader.Name == "Node" && reader.IsStartElement()) { Node node = new Node(); node.Location = ConvertStringtoPoint(reader.GetAttribute("Location")); node.Size = ConvertStringToSize(reader.GetAttribute("Size")); node.RefeshMidpoint(); node.Content = reader.GetAttribute("Content"); node.BackGroundColor = Color.FromArgb(int.Parse(reader.GetAttribute("BackGroundColor"))); node.BorderColor = Color.FromArgb(int.Parse(reader.GetAttribute("BorderColor"))); Font font = new Font(reader.GetAttribute("FontName"), float.Parse(reader.GetAttribute("FontSize"))); bool bold = reader.GetAttribute("FontBold") == "True" ? true : false; bool Italic = reader.GetAttribute("FontItalic") == "True" ? true : false; bool Underline = reader.GetAttribute("FontUnderline") == "True" ? true : false; FontStyle style = font.Style; if (bold) { style |= FontStyle.Bold; } if (Italic) { style |= FontStyle.Italic; } if (Underline) { style |= FontStyle.Underline; } node.NodeFont = new Font(font, style); var textAli = reader.GetAttribute("TextAli"); if (textAli == ContentAlignment.TopCenter.ToString()) { node.get_label_of_node.TextAlign = ContentAlignment.TopCenter; } else if (textAli == ContentAlignment.TopLeft.ToString()) { node.get_label_of_node.TextAlign = ContentAlignment.TopLeft; } else { node.get_label_of_node.TextAlign = ContentAlignment.TopRight; } node.Tag = reader.GetAttribute("Tag"); int num = int.Parse(reader.GetAttribute("NumIcon")); for (int i = 1; i < num; i++) { var a = UCIcon.icons.Find(x => x.Tag.ToString() == reader.GetAttribute("Icon" + i.ToString())); OvalPictureBox box = new OvalPictureBox(); box.Size = a.Size; box.Image = a.Image; box.BackColor = a.BackColor; box.BackgroundImage = a.BackgroundImage; box.Tag = a.Tag; box.DoubleClick += Box_DoubleClick; node.flowLayoutPanel1.Controls.Add(box); } (control.Parent as MainPage).Addnode(node); } if (reader.Name == "line" && reader.IsStartElement()) { var line = NodeController.FindNodeWithTag(reader.GetAttribute("NodeTag")); NodeController.source.Add(line); } } NodeController.Reefeshpaint(); (control.Parent as MainPage).Controls.Find("panelPaint", true).SingleOrDefault().Refresh(); } }