private void refresh() { sWindowStyle style = (sWindowStyle)cDataBase.pWindowstyles.get(); foreach (sWindowStyle.sBorderSet borderset in style.pBorderSets.Values) { comboBoxStyles.Items.Add(borderset.pName); } comboBoxStyles.SelectedIndex = 0; //refreshStyle(); }
private void refreshStyle() { sWindowStyle style = (sWindowStyle)cDataBase.pWindowstyles.get(); sWindowStyle.sBorderSet borderset = (sWindowStyle.sBorderSet)style.pBorderSets[comboBoxStyles.SelectedItem.ToString()]; propertyGridTable.SelectedObject = borderset; // MOD: fixed Unhandled Exception when a file(borderset) not found... // MOD: Clear Textboxes and Pictureboxes if (borderset.pbpTopLeftName.Length > 0 && System.IO.File.Exists(cDataBase.getPath(borderset.pbpTopLeftName))) { if (Path.GetExtension(cDataBase.getPath(borderset.pbpTopLeftName)).ToLower() == ".svg") { string PNGPath = cDataBase.getPNGPath(cDataBase.getPath(borderset.pbpTopLeftName)); if (File.Exists(PNGPath)) { textBoxTopLeft.Text = borderset.pbpTopLeftName.ToLower().Replace(".svg", ".png"); pictureBoxTopLeft.Image = Image.FromFile(PNGPath); } } else { textBoxTopLeft.Text = borderset.pbpTopLeftName; pictureBoxTopLeft.Image = Image.FromFile(cDataBase.getPath(borderset.pbpTopLeftName)); } } else { textBoxTopLeft.Text = string.Empty; pictureBoxTopLeft.Image = null; } if (borderset.pbpTopName.Length > 0 && System.IO.File.Exists(cDataBase.getPath(borderset.pbpTopName))) { if (Path.GetExtension(cDataBase.getPath(borderset.pbpTopName)).ToLower() == ".svg") { string PNGPath = cDataBase.getPNGPath(cDataBase.getPath(borderset.pbpTopName)); if (File.Exists(PNGPath)) { textBoxTop.Text = borderset.pbpTopName.ToLower().Replace(".svg", ".png"); pictureBoxTop.Image = Image.FromFile(PNGPath); } } else { textBoxTop.Text = borderset.pbpTopName; pictureBoxTop.Image = Image.FromFile(cDataBase.getPath(borderset.pbpTopName)); } } else { textBoxTop.Text = string.Empty; pictureBoxTop.Image = null; } if (borderset.pbpTopRightName.Length > 0 && System.IO.File.Exists(cDataBase.getPath(borderset.pbpTopRightName))) { if (Path.GetExtension(cDataBase.getPath(borderset.pbpTopRightName)).ToLower() == ".svg") { string PNGPath = cDataBase.getPNGPath(cDataBase.getPath(borderset.pbpTopRightName)); if (File.Exists(PNGPath)) { textBoxTopRight.Text = borderset.pbpTopRightName.ToLower().Replace(".svg", ".png"); pictureBoxTopRight.Image = Image.FromFile(PNGPath); } } else { textBoxTopRight.Text = borderset.pbpTopRightName; pictureBoxTopRight.Image = Image.FromFile(cDataBase.getPath(borderset.pbpTopRightName)); } } else { textBoxTopRight.Text = string.Empty; pictureBoxTopRight.Image = null; } if (borderset.pbpLeftName.Length > 0 && System.IO.File.Exists(cDataBase.getPath(borderset.pbpLeftName))) { if (Path.GetExtension(cDataBase.getPath(borderset.pbpLeftName)).ToLower() == ".svg") { string PNGPath = cDataBase.getPNGPath(cDataBase.getPath(borderset.pbpLeftName)); if (File.Exists(PNGPath)) { textBoxLeft.Text = borderset.pbpLeftName.ToLower().Replace(".svg", ".png"); pictureBoxLeft.Image = Image.FromFile(PNGPath); } } else { textBoxLeft.Text = borderset.pbpLeftName; pictureBoxLeft.Image = Image.FromFile(cDataBase.getPath(borderset.pbpLeftName)); } } else { textBoxLeft.Text = string.Empty; pictureBoxLeft.Image = null; } if (borderset.pbpRightName.Length > 0 && System.IO.File.Exists(cDataBase.getPath(borderset.pbpRightName))) { if (Path.GetExtension(cDataBase.getPath(borderset.pbpRightName)).ToLower() == ".svg") { string PNGPath = cDataBase.getPNGPath(cDataBase.getPath(borderset.pbpRightName)); if (File.Exists(PNGPath)) { textBoxRight.Text = borderset.pbpRightName.ToLower().Replace(".svg", ".png"); pictureBoxRight.Image = Image.FromFile(PNGPath); } } else { textBoxRight.Text = borderset.pbpRightName; pictureBoxRight.Image = Image.FromFile(cDataBase.getPath(borderset.pbpRightName)); } } else { textBoxRight.Text = string.Empty; pictureBoxRight.Image = null; } if (borderset.pbpBottomLeftName.Length > 0 && System.IO.File.Exists(cDataBase.getPath(borderset.pbpBottomLeftName))) { if (Path.GetExtension(cDataBase.getPath(borderset.pbpBottomLeftName)).ToLower() == ".svg") { string PNGPath = cDataBase.getPNGPath(cDataBase.getPath(borderset.pbpBottomLeftName)); if (File.Exists(PNGPath)) { textBoxBottomLeft.Text = borderset.pbpBottomLeftName.ToLower().Replace(".svg", ".png"); pictureBoxBottomLeft.Image = Image.FromFile(PNGPath); } } else { textBoxBottomLeft.Text = borderset.pbpBottomLeftName; pictureBoxBottomLeft.Image = Image.FromFile(cDataBase.getPath(borderset.pbpBottomLeftName)); } } else { textBoxBottomLeft.Text = string.Empty; pictureBoxBottomLeft.Image = null; } if (borderset.pbpBottomName.Length > 0 && System.IO.File.Exists(cDataBase.getPath(borderset.pbpBottomName))) { if (Path.GetExtension(cDataBase.getPath(borderset.pbpBottomName)).ToLower() == ".svg") { string PNGPath = cDataBase.getPNGPath(cDataBase.getPath(borderset.pbpBottomName)); if (File.Exists(PNGPath)) { textBoxBottom.Text = borderset.pbpBottomName.ToLower().Replace(".svg", ".png"); pictureBoxBottom.Image = Image.FromFile(PNGPath); } } else { textBoxBottom.Text = borderset.pbpBottomName; pictureBoxBottom.Image = Image.FromFile(cDataBase.getPath(borderset.pbpBottomName)); } } else { textBoxBottom.Text = string.Empty; pictureBoxBottom.Image = null; } if (borderset.pbpBottomRightName.Length > 0 && System.IO.File.Exists(cDataBase.getPath(borderset.pbpBottomRightName))) { if (Path.GetExtension(cDataBase.getPath(borderset.pbpBottomRightName)).ToLower() == ".svg") { string PNGPath = cDataBase.getPNGPath(cDataBase.getPath(borderset.pbpBottomRightName)); if (File.Exists(PNGPath)) { textBoxBottomRight.Text = borderset.pbpBottomRightName.ToLower().Replace(".svg", ".png"); pictureBoxBottomRight.Image = Image.FromFile(PNGPath); } } else { textBoxBottomRight.Text = borderset.pbpBottomRightName; pictureBoxBottomRight.Image = Image.FromFile(cDataBase.getPath(borderset.pbpBottomRightName)); } } else { textBoxBottomRight.Text = string.Empty; pictureBoxBottomRight.Image = null; } sAttributeScreen attr = new sAttributeScreen(null); attr.pZPosition = -100; attr.pAbsolutX = attr.pRelativX = 50; attr.pAbsolutY = attr.pRelativY = 50; attr.pWidth = 200; attr.pHeight = 200; attr.pBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["Background"]; attr.pLabelForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["LabelForeground"]; attr.pTitle = "Title"; attr.pTitleFont = ((sWindowStyle)cDataBase.pWindowstyles.get()).pFont; attr.pTitleSize = ((sWindowStyle)cDataBase.pWindowstyles.get()).pTitleSize * (((float)attr.pTitleFont.Scale) / 100.0F); attr.pTitleXOff = ((sWindowStyle)cDataBase.pWindowstyles.get()).pXOff; attr.pTitleYOff = ((sWindowStyle)cDataBase.pWindowstyles.get()).pYOff; attr.pbpTopLeft = borderset.pbpTopLeft; attr.pbpTop = borderset.pbpTop; attr.pbpTopRight = borderset.pbpTopRight; attr.pbpLeft = borderset.pbpLeft; attr.pbpRight = borderset.pbpRight; attr.pbpBottomLeft = borderset.pbpBottomLeft; attr.pbpBottom = borderset.pbpBottom; attr.pbpBottomRight = borderset.pbpBottomRight; //attr.Flags = "wfBorder"; pDesigner.clear(); pDesigner.draw(attr); }
public cDataBaseWindowstyle(cXMLHandler XmlHandler) { Hashtable colors = new Hashtable(); sFont titlefont = null; float titlesize = (float)0.0; Int32 xOff = 0, yOff = 0; ArrayList bordersets = new ArrayList(); string[] path = { /*"skin", */ "windowstyle" }; XmlNode styleNode = XmlHandler.XmlGetRootNodeElement(path); if (styleNode == null) { //<font filename= name= scale="90" /> sFont font = new sFont( "Regular", "nmsbd.ttf", 90, false ); pFonts.Add(font.Name, font); colors.Add("Background", pColors.get("#25062748")); colors.Add("LabelForeground", pColors.get("#ffffff")); colors.Add("ListboxBackground", pColors.get("#25062748")); colors.Add("ListboxForeground", pColors.get("#ffffff")); colors.Add("ListboxSelectedBackground", pColors.get("#254f7497")); colors.Add("ListboxSelectedForeground", pColors.get("#ffffff")); colors.Add("ListboxMarkedBackground", pColors.get("#ff0000")); colors.Add("ListboxMarkedForeground", pColors.get("#ffffff")); colors.Add("ListboxMarkedAndSelectedBackground", pColors.get("#800000")); colors.Add("ListboxMarkedAndSelectedForeground", pColors.get("#ffffff")); colors.Add("WindowTitleForeground", pColors.get("#ffffff")); colors.Add("WindowTitleBackground", pColors.get("#25062748")); sWindowStyle.sBorderSet borderset = new sWindowStyle.sBorderSet( "bsWindow", "skin_default/b_tl.png", "skin_default/b_t.png", "skin_default/b_tr.png", "skin_default/b_l.png", "skin_default/b_r.png", "skin_default/b_bl.png", "skin_default/b_b.png", "skin_default/b_br.png"); bordersets.Add(borderset); pWindowStyle = new sWindowStyle(getFont("Regular"), 20.0f, 33, 14, colors, (sWindowStyle.sBorderSet[])bordersets.ToArray(typeof(sWindowStyle.sBorderSet))); } else { foreach (XmlNode myXmlNode in styleNode.ChildNodes) { if (myXmlNode.Name == "color") { if (colors[myXmlNode.Attributes["color"].Value] == null) { colors.Add(myXmlNode.Attributes["name"].Value, pColors.get(myXmlNode.Attributes["color"].Value)); } } else if (myXmlNode.Name == "title") { String font = myXmlNode.Attributes["font"].Value; titlesize = Convert.ToSingle(font.Substring(font.IndexOf(';') + 1)); font = font.Substring(0, font.IndexOf(';')); titlefont = getFont(font); xOff = Convert.ToInt32(myXmlNode.Attributes["offset"].Value.Substring(0, myXmlNode.Attributes["offset"].Value.IndexOf(','))); yOff = Convert.ToInt32(myXmlNode.Attributes["offset"].Value.Substring(myXmlNode.Attributes["offset"].Value.IndexOf(',') + 1)); } else if (myXmlNode.Name == "borderset") { String pbpTopLeftName = ""; String pbpTopName = ""; String pbpTopRightName = ""; String pbpLeftName = ""; String pbpRightName = ""; String pbpBottomLeftName = ""; String pbpBottomName = ""; String pbpBottomRightName = ""; //string[] path2 = { "skin", "windowstyle", "borderset" }; //XmlNode fontNode2 = XmlHandler.XmlGetRootNodeElement(path2); foreach (XmlNode myXmlNode2 in /*fontNode2*/ myXmlNode.ChildNodes) { if (myXmlNode2.Attributes["pos"].Value == "bpTopLeft") { pbpTopLeftName = myXmlNode2.Attributes["filename"].Value; } else if (myXmlNode2.Attributes["pos"].Value == "bpTop") { pbpTopName = myXmlNode2.Attributes["filename"].Value; } else if (myXmlNode2.Attributes["pos"].Value == "bpTopRight") { pbpTopRightName = myXmlNode2.Attributes["filename"].Value; } else if (myXmlNode2.Attributes["pos"].Value == "bpLeft") { pbpLeftName = myXmlNode2.Attributes["filename"].Value; } else if (myXmlNode2.Attributes["pos"].Value == "bpRight") { pbpRightName = myXmlNode2.Attributes["filename"].Value; } else if (myXmlNode2.Attributes["pos"].Value == "bpBottomLeft") { pbpBottomLeftName = myXmlNode2.Attributes["filename"].Value; } else if (myXmlNode2.Attributes["pos"].Value == "bpBottom") { pbpBottomName = myXmlNode2.Attributes["filename"].Value; } else if (myXmlNode2.Attributes["pos"].Value == "bpBottomRight") { pbpBottomRightName = myXmlNode2.Attributes["filename"].Value; } } sWindowStyle.sBorderSet borderset = new sWindowStyle.sBorderSet( myXmlNode.Attributes["name"].Value, pbpTopLeftName, pbpTopName, pbpTopRightName, pbpLeftName, pbpRightName, pbpBottomLeftName, pbpBottomName, pbpBottomRightName); bordersets.Add(borderset); } } pWindowStyle = new sWindowStyle(titlefont, titlesize, xOff, yOff, colors, (sWindowStyle.sBorderSet[])bordersets.ToArray(typeof(sWindowStyle.sBorderSet))); } }
public cDataBaseWindowstyle(cXMLHandler XmlHandler) { Hashtable colors = new Hashtable(); sFont titlefont = null; float titlesize = (float)0.0; Int32 xOff = 0, yOff = 0; ArrayList bordersets = new ArrayList(); string[] path = { /*"skin", */ "windowstyle" }; XmlNode styleNode = XmlHandler.XmlGetRootNodeElement(path); if (styleNode == null) { //<font filename= name= scale="90" /> sFont font = new sFont( "Regular", "nmsbd.ttf", 90, 30, "nmsbd", false ); pFonts.Add(font.Name, font); colors.Add("Background", pColors.get("#25062748")); colors.Add("LabelForeground", pColors.get("#ffffff")); colors.Add("ListboxBackground", pColors.get("#25062748")); colors.Add("ListboxForeground", pColors.get("#ffffff")); colors.Add("ListboxSelectedBackground", pColors.get("#254f7497")); colors.Add("ListboxSelectedForeground", pColors.get("#ffffff")); colors.Add("ListboxMarkedBackground", pColors.get("#ff0000")); colors.Add("ListboxMarkedForeground", pColors.get("#ffffff")); colors.Add("ListboxMarkedAndSelectedBackground", pColors.get("#800000")); colors.Add("ListboxMarkedAndSelectedForeground", pColors.get("#ffffff")); colors.Add("WindowTitleForeground", pColors.get("#ffffff")); colors.Add("WindowTitleBackground", pColors.get("#25062748")); sWindowStyle.sBorderSet borderset = new sWindowStyle.sBorderSet( "bsWindow", "skin_default/b_tl.png", "skin_default/b_t.png", "skin_default/b_tr.png", "skin_default/b_l.png", "skin_default/b_r.png", "skin_default/b_bl.png", "skin_default/b_b.png", "skin_default/b_br.png"); bordersets.Add(borderset); pWindowStyle = new sWindowStyle(getFont("Regular"), 20.0f, 33, 14, colors, (sWindowStyle.sBorderSet[])bordersets.ToArray(typeof(sWindowStyle.sBorderSet))); } else { foreach (XmlNode myXmlNode in styleNode.ChildNodes) { if (myXmlNode.Name == "color") { if (colors[myXmlNode.Attributes["color"].Value] == null) { colors.Add(myXmlNode.Attributes["name"].Value, pColors.get(myXmlNode.Attributes["color"].Value)); } } else if (myXmlNode.Name == "title") { String font = myXmlNode.Attributes["font"].Value; titlesize = Convert.ToSingle(font.Substring(font.IndexOf(';') + 1)); font = font.Substring(0, font.IndexOf(';')); titlefont = getFont(font); xOff = Convert.ToInt32(myXmlNode.Attributes["offset"].Value.Substring(0, myXmlNode.Attributes["offset"].Value.IndexOf(','))); yOff = Convert.ToInt32(myXmlNode.Attributes["offset"].Value.Substring(myXmlNode.Attributes["offset"].Value.IndexOf(',') + 1)); } else if (myXmlNode.Name == "borderset") { String pbpTopLeftName = ""; String pbpTopName = ""; String pbpTopRightName = ""; String pbpLeftName = ""; String pbpRightName = ""; String pbpBottomLeftName = ""; String pbpBottomName = ""; String pbpBottomRightName = ""; //string[] path2 = { "skin", "windowstyle", "borderset" }; //XmlNode fontNode2 = XmlHandler.XmlGetRootNodeElement(path2); int anz = 0; foreach (XmlNode myXmlNode2 in /*fontNode2*/ myXmlNode.ChildNodes) { try { if (myXmlNode2.Attributes["pos"] != null) { if (myXmlNode2.Attributes["pos"].Value == "bpTopLeft") { if (myXmlNode2.OuterXml.Contains("filename=")) { pbpTopLeftName = myXmlNode2.Attributes["filename"].Value; } else { anz += 1; } } else if (myXmlNode2.Attributes["pos"].Value == "bpTop") { if (myXmlNode2.OuterXml.Contains("filename=")) { pbpTopName = myXmlNode2.Attributes["filename"].Value; } else { anz += 1; } } else if (myXmlNode2.Attributes["pos"].Value == "bpTopRight") { if (myXmlNode2.OuterXml.Contains("filename=")) { pbpTopRightName = myXmlNode2.Attributes["filename"].Value; } else { anz += 1; } } else if (myXmlNode2.Attributes["pos"].Value == "bpLeft") { if (myXmlNode2.OuterXml.Contains("filename=")) { pbpLeftName = myXmlNode2.Attributes["filename"].Value; } else { anz += 1; } } else if (myXmlNode2.Attributes["pos"].Value == "bpRight") { if (myXmlNode2.OuterXml.Contains("filename=")) { pbpRightName = myXmlNode2.Attributes["filename"].Value; } else { anz += 1; } } else if (myXmlNode2.Attributes["pos"].Value == "bpBottomLeft") { if (myXmlNode2.OuterXml.Contains("filename=")) { pbpBottomLeftName = myXmlNode2.Attributes["filename"].Value; } else { anz += 1; } } else if (myXmlNode2.Attributes["pos"].Value == "bpBottom") { if (myXmlNode2.OuterXml.Contains("filename=")) { pbpBottomName = myXmlNode2.Attributes["filename"].Value; } else { anz += 1; } } else if (myXmlNode2.Attributes["pos"].Value == "bpBottomRight") { if (myXmlNode2.OuterXml.Contains("filename=")) { pbpBottomRightName = myXmlNode2.Attributes["filename"].Value; } else { anz += 1; } } } else { // [pos] = null } } catch (NullReferenceException err) { MessageBox.Show("There is something wrong with your borderset" + "\n\n" + err.Message); } } if (anz > 0) { MessageBox.Show("The path of " + anz + " borderset-files is not specified!" + "\n\n", "Path(s) not specified", MessageBoxButtons.OK, MessageBoxIcon.Information); } sWindowStyle.sBorderSet borderset = new sWindowStyle.sBorderSet( myXmlNode.Attributes["name"].Value, pbpTopLeftName, pbpTopName, pbpTopRightName, pbpLeftName, pbpRightName, pbpBottomLeftName, pbpBottomName, pbpBottomRightName); bordersets.Add(borderset); } } pWindowStyle = new sWindowStyle(titlefont, titlesize, xOff, yOff, colors, (sWindowStyle.sBorderSet[])bordersets.ToArray(typeof(sWindowStyle.sBorderSet))); } }
private void refreshStyle() { sWindowStyle style = (sWindowStyle)cDataBase.pWindowstyles.get(); sWindowStyle.sBorderSet borderset = (sWindowStyle.sBorderSet)style.pBorderSets[comboBoxStyles.SelectedItem.ToString()]; propertyGridTable.SelectedObject = borderset; if (borderset.pbpTopLeftName.Length > 0) { textBoxTopLeft.Text = borderset.pbpTopLeftName; pictureBoxTopLeft.Image = Image.FromFile(cDataBase.getPath(borderset.pbpTopLeftName)); } if (borderset.pbpTopName.Length > 0) { textBoxTop.Text = borderset.pbpTopName; pictureBoxTop.Image = Image.FromFile(cDataBase.getPath(borderset.pbpTopName)); } if (borderset.pbpTopRightName.Length > 0) { textBoxTopRight.Text = borderset.pbpTopRightName; pictureBoxTopRight.Image = Image.FromFile(cDataBase.getPath(borderset.pbpTopRightName)); } if (borderset.pbpLeftName.Length > 0) { textBoxLeft.Text = borderset.pbpLeftName; pictureBoxLeft.Image = Image.FromFile(cDataBase.getPath(borderset.pbpLeftName)); } if (borderset.pbpRightName.Length > 0) { textBoxRight.Text = borderset.pbpRightName; pictureBoxRight.Image = Image.FromFile(cDataBase.getPath(borderset.pbpRightName)); } if (borderset.pbpBottomLeftName.Length > 0) { textBoxBottomLeft.Text = borderset.pbpBottomLeftName; pictureBoxBottomLeft.Image = Image.FromFile(cDataBase.getPath(borderset.pbpBottomLeftName)); } if (borderset.pbpBottomName.Length > 0) { textBoxBottom.Text = borderset.pbpBottomName; pictureBoxBottom.Image = Image.FromFile(cDataBase.getPath(borderset.pbpBottomName)); } if (borderset.pbpBottomRightName.Length > 0) { textBoxBottomRight.Text = borderset.pbpBottomRightName; pictureBoxBottomRight.Image = Image.FromFile(cDataBase.getPath(borderset.pbpBottomRightName)); } sAttributeScreen attr = new sAttributeScreen(null); attr.pZPosition = -100; attr.pAbsolutX = attr.pRelativX = 50; attr.pAbsolutY = attr.pRelativY = 50; attr.pWidth = 200; attr.pHeight = 200; attr.pBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["Background"]; attr.pLabelForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["LabelForeground"]; attr.pTitle = "Title"; attr.pTitleFont = ((sWindowStyle)cDataBase.pWindowstyles.get()).pFont; attr.pTitleSize = ((sWindowStyle)cDataBase.pWindowstyles.get()).pTitleSize * (((float)attr.pTitleFont.Scale) / 100.0F); attr.pTitleXOff = ((sWindowStyle)cDataBase.pWindowstyles.get()).pXOff; attr.pTitleYOff = ((sWindowStyle)cDataBase.pWindowstyles.get()).pYOff; attr.pbpTopLeft = borderset.pbpTopLeft; attr.pbpTop = borderset.pbpTop; attr.pbpTopRight = borderset.pbpTopRight; attr.pbpLeft = borderset.pbpLeft; attr.pbpRight = borderset.pbpRight; attr.pbpBottomLeft = borderset.pbpBottomLeft; attr.pbpBottom = borderset.pbpBottom; attr.pbpBottomRight = borderset.pbpBottomRight; //attr.Flags = "wfBorder"; pDesigner.clear(); pDesigner.draw(attr); }