public override void Deserialize(ItemSerializationContext context) { base.Deserialize(context); System.Xml.XmlElement ItemXmlSource = context.ItemXmlElement; if(ItemXmlSource.HasAttribute("Caption")) this.Caption = ItemXmlSource.GetAttribute("Caption"); m_TextBoxWidth=System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("TextBoxWidth")); m_AlwaysShowCaption=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("AlwaysShowCaption")); m_MenuVisibility=(eMenuVisibility)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("MenuVisibility")); m_RecentlyUsed=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("RecentlyUsed")); }
public override void Deserialize(ItemSerializationContext context) { base.Deserialize(context); System.Xml.XmlElement ItemXmlSource = context.ItemXmlElement; m_ComboWidth=System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("ComboWidth")); m_FontCombo=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("FontCombo")); m_MenuVisibility=(eMenuVisibility)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("MenuVisibility")); m_RecentlyUsed=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("RecentlyUsed")); if(ItemXmlSource.HasAttribute("DropDownStyle")) m_ComboBox.DropDownStyle=(System.Windows.Forms.ComboBoxStyle)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("DropDownStyle")); if(ItemXmlSource.HasAttribute("CText")) this.Text=ItemXmlSource.GetAttribute("CText"); if(ItemXmlSource.HasAttribute("ThemeAware")) m_ComboBox.ThemeAware=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("ThemeAware")); else m_ComboBox.ThemeAware=true; if(ItemXmlSource.HasAttribute("AlwaysShowCaption")) m_AlwaysShowCaption=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("AlwaysShowCaption")); if(ItemXmlSource.HasAttribute("nobeep")) this.PreventEnterBeep=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("nobeep")); System.Xml.XmlNodeList list=ItemXmlSource.GetElementsByTagName("cbitems"); if(!m_FontCombo && list.Count>0) { foreach(System.Xml.XmlElement xmlChild in list[0].ChildNodes) { if(xmlChild.Name=="ci") { DevComponents.Editors.ComboItem ci=new DevComponents.Editors.ComboItem(); if(xmlChild.HasAttribute("bc")) ci.BackColor=BarFunctions.ColorFromString(xmlChild.GetAttribute("bk")); if(xmlChild.HasAttribute("fn")) ci.FontName=xmlChild.GetAttribute("fn"); if(xmlChild.HasAttribute("fs")) ci.FontSize=System.Xml.XmlConvert.ToSingle(xmlChild.GetAttribute("fs")); if(xmlChild.HasAttribute("fy")) ci.FontStyle=(FontStyle)System.Xml.XmlConvert.ToInt32(xmlChild.GetAttribute("fy")); if(xmlChild.HasAttribute("fc")) ci.ForeColor=BarFunctions.ColorFromString(xmlChild.GetAttribute("fc")); ci.Image=BarFunctions.DeserializeImage(xmlChild); if(xmlChild.HasAttribute("img")) ci.ImageIndex=System.Xml.XmlConvert.ToInt32(xmlChild.GetAttribute("img")); if(xmlChild.HasAttribute("ip")) ci.ImagePosition=(System.Windows.Forms.HorizontalAlignment)System.Xml.XmlConvert.ToInt32(xmlChild.GetAttribute("ip")); if(xmlChild.HasAttribute("ItemHeight")) m_ComboBox.ItemHeight=System.Xml.XmlConvert.ToInt32(xmlChild.GetAttribute("ItemHeight")); ci.Text=xmlChild.GetAttribute("text"); ci.TextAlignment=(StringAlignment)System.Xml.XmlConvert.ToInt32(xmlChild.GetAttribute("ta")); ci.TextLineAlignment=(StringAlignment)System.Xml.XmlConvert.ToInt32(xmlChild.GetAttribute("tla")); m_ComboBox.Items.Add(ci); if(xmlChild.HasAttribute("selected") && xmlChild.GetAttribute("selected")=="1") m_ComboBox.SelectedItem=ci; } else if(xmlChild.Name=="co") { m_ComboBox.Items.Add(xmlChild.InnerText); if(xmlChild.HasAttribute("selected") && xmlChild.GetAttribute("selected")=="1") m_ComboBox.SelectedItem=m_ComboBox.Items[m_ComboBox.Items.Count-1]; } } } if(m_FontCombo) m_ComboBox.LoadFonts(); if(m_ComboBox!=null) m_ComboBox.Enabled=this.Enabled; if (ItemXmlSource.HasAttribute("DisplayMembers") && m_ComboBox!=null) m_ComboBox.DisplayMember = ItemXmlSource.GetAttribute("DisplayMembers"); }
/// <summary> /// Overloaded. Deserializes the Item from the XmlElement. /// </summary> /// <param name="ItemXmlSource">Source XmlElement.</param> public override void Deserialize(ItemSerializationContext context) { base.Deserialize(context); System.Xml.XmlElement ItemXmlSource = context.ItemXmlElement; m_ImagePosition = (eImagePosition)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("ImagePosition")); m_ButtonStyle = (eButtonStyle)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("ButtonStyle")); m_Checked = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("Checked")); m_VerticalPadding = System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("VerticalPadding")); m_HorizontalPadding = System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("HorizontalPadding")); m_MenuVisibility = (eMenuVisibility)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("MenuVisibility")); m_RecentlyUsed = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("RecentlyUsed")); if (ItemXmlSource.HasAttribute("forecolor")) m_ForeColor = BarFunctions.ColorFromString(ItemXmlSource.GetAttribute("forecolor")); else m_ForeColor = System.Drawing.Color.Empty; if (ItemXmlSource.HasAttribute("hottrack")) m_HotTrackingStyle = (eHotTrackingStyle)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("hottrack")); else m_HotTrackingStyle = eHotTrackingStyle.Default; if (ItemXmlSource.HasAttribute("hotclr")) m_HotForeColor = BarFunctions.ColorFromString(ItemXmlSource.GetAttribute("hotclr")); else m_HotForeColor = System.Drawing.Color.Empty; if (ItemXmlSource.HasAttribute("hotfb")) m_HotFontBold = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("hotfb")); else m_HotFontBold = false; if (ItemXmlSource.HasAttribute("hotfu")) m_HotFontUnderline = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("hotfu")); else m_HotFontUnderline = false; if (ItemXmlSource.HasAttribute("optiongroup")) m_OptionGroup = ItemXmlSource.GetAttribute("optiongroup"); else m_OptionGroup = ""; if (ItemXmlSource.HasAttribute("fontbold")) m_FontBold = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("fontbold")); else m_FontBold = false; if (ItemXmlSource.HasAttribute("fontitalic")) m_FontItalic = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("fontitalic")); else m_FontItalic = false; if (ItemXmlSource.HasAttribute("fontunderline")) m_FontUnderline = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("fontunderline")); else m_FontUnderline = false; if (ItemXmlSource.HasAttribute("AlternateShortcutText")) m_AlternateShortcutText = ItemXmlSource.GetAttribute("AlternateShortcutText"); else m_AlternateShortcutText = ""; if (ItemXmlSource.HasAttribute("autoexpandclick")) m_AutoExpandOnClick = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("autoexpandclick")); else m_AutoExpandOnClick = false; if (ItemXmlSource.HasAttribute("CustomColorName")) m_CustomColorName = ItemXmlSource.GetAttribute("CustomColorName"); else m_CustomColorName = ""; if (ItemXmlSource.HasAttribute("ColorTable")) m_ColorTable = (eButtonColor)Enum.Parse(m_ColorTable.GetType(), ItemXmlSource.GetAttribute("ColorTable")); else m_ColorTable = eButtonColor.Orange; m_ImageIndex = -1; m_HoverImageIndex = -1; m_DisabledImageIndex = -1; m_PressedImageIndex = -1; m_Icon = null; m_Image = null; m_ImageSmall = null; m_HoverImage = null; m_DisabledImage = null; m_DisabledImageCustom = false; m_PressedImage = null; // Load Images foreach (System.Xml.XmlElement xmlElem in ItemXmlSource.ChildNodes) { if (xmlElem.Name == "images") { if (xmlElem.HasAttribute("imageindex")) m_ImageIndex = System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("imageindex")); if (xmlElem.HasAttribute("hoverimageindex")) m_HoverImageIndex = System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("hoverimageindex")); if (xmlElem.HasAttribute("disabledimageindex")) m_DisabledImageIndex = System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("disabledimageindex")); if (xmlElem.HasAttribute("pressedimageindex")) m_PressedImageIndex = System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("pressedimageindex")); foreach (System.Xml.XmlElement xmlElem2 in xmlElem.ChildNodes) { switch (xmlElem2.GetAttribute("type")) { case "default": { m_Image = BarFunctions.DeserializeImage(xmlElem2); m_ImageIndex = -1; break; } case "icon": { m_Icon = BarFunctions.DeserializeIcon(xmlElem2); m_ImageIndex = -1; break; } case "hover": { m_HoverImage = BarFunctions.DeserializeImage(xmlElem2); m_HoverImageIndex = -1; break; } case "disabled": { m_DisabledImage = BarFunctions.DeserializeImage(xmlElem2); m_DisabledImageIndex = -1; m_DisabledImageCustom = true; break; } case "pressed": { m_PressedImage = BarFunctions.DeserializeImage(xmlElem2); m_PressedImageIndex = -1; break; } case "small": { m_ImageSmall = BarFunctions.DeserializeImage(xmlElem2); break; } } } break; } } this.OnImageChanged(); }