コード例 #1
0
		protected internal override void Serialize(ItemSerializationContext context)
		{
			base.Serialize(context);
            System.Xml.XmlElement ThisItem = context.ItemXmlElement;
			ThisItem.SetAttribute("bt",System.Xml.XmlConvert.ToString(((int)m_BorderType)));
            if(m_BorderSide!=DEFAULT_BORDERSIDE)
                ThisItem.SetAttribute("BorderSide", System.Xml.XmlConvert.ToString(((int)m_BorderSide)));
			if(!m_BackColor.IsEmpty)
				ThisItem.SetAttribute("bc",BarFunctions.ColorToString(m_BackColor));
			ThisItem.SetAttribute("fc",BarFunctions.ColorToString(m_ForeColor));
			if(m_SingleLineColorCustom)
				ThisItem.SetAttribute("sc",BarFunctions.ColorToString(m_SingleLineColor));
			ThisItem.SetAttribute("ta",System.Xml.XmlConvert.ToString(((int)m_TextAlignment)));
			ThisItem.SetAttribute("tla",System.Xml.XmlConvert.ToString(((int)m_TextLineAlignment)));
			ThisItem.SetAttribute("ds",System.Xml.XmlConvert.ToString(m_DividerStyle));
			ThisItem.SetAttribute("pl",System.Xml.XmlConvert.ToString(m_PaddingLeft));
			ThisItem.SetAttribute("pr",System.Xml.XmlConvert.ToString(m_PaddingRight));
			ThisItem.SetAttribute("pt",System.Xml.XmlConvert.ToString(m_PaddingTop));
			ThisItem.SetAttribute("pb",System.Xml.XmlConvert.ToString(m_PaddingBottom));
			ThisItem.SetAttribute("w",System.Xml.XmlConvert.ToString(m_Width));
			ThisItem.SetAttribute("h",System.Xml.XmlConvert.ToString(m_Height));

			// Save Font information if needed
			if(this.Font!=null)
			{
				if(this.Font.Name!=System.Windows.Forms.SystemInformation.MenuFont.Name || this.Font.Size!=System.Windows.Forms.SystemInformation.MenuFont.Size || this.Font.Style!=System.Windows.Forms.SystemInformation.MenuFont.Style)
				{
					ThisItem.SetAttribute("fontname",this.Font.Name);
					ThisItem.SetAttribute("fontemsize",System.Xml.XmlConvert.ToString(this.Font.Size));
					ThisItem.SetAttribute("fontstyle",System.Xml.XmlConvert.ToString((int)this.Font.Style));
				}
			}

			System.Xml.XmlElement xmlElem=null, xmlElem2=null;
            
			// Serialize Images
			if(m_Image!=null || m_ImageIndex>=0 || m_Icon!=null)
			{
				xmlElem=ThisItem.OwnerDocument.CreateElement("images");
				ThisItem.AppendChild(xmlElem);

				if(m_ImageIndex>=0)
					xmlElem.SetAttribute("imageindex",System.Xml.XmlConvert.ToString(m_ImageIndex));

				if(m_Image!=null)
				{
					xmlElem2=ThisItem.OwnerDocument.CreateElement("image");
					xmlElem2.SetAttribute("type","default");
					xmlElem.AppendChild(xmlElem2);
					BarFunctions.SerializeImage(m_Image,xmlElem2);
				}
				if(m_Icon!=null)
				{
					xmlElem2=ThisItem.OwnerDocument.CreateElement("image");
					xmlElem2.SetAttribute("type","icon");
					xmlElem.AppendChild(xmlElem2);
					BarFunctions.SerializeIcon(m_Icon,xmlElem2);
				}
			}
		}
コード例 #2
0
		private void DeserializeDocumentDockContainer(ItemSerializationContext context, DocumentDockContainer instance, bool deserializeDefinition)
		{
            XmlElement docElement = context.ItemXmlElement;
			if(docElement.Name!=DocumentSerializationXml.DockContainer)
				return;

			instance.Documents.Clear();
			instance.Orientation=(eOrientation)XmlConvert.ToInt32(docElement.GetAttribute(DocumentSerializationXml.Orientation));
            if (docElement.HasAttribute(DocumentSerializationXml.Width) && docElement.HasAttribute(DocumentSerializationXml.Height))
            {
                instance.SetLayoutBounds(new Rectangle(0,0,
                    XmlConvert.ToInt32(docElement.GetAttribute(DocumentSerializationXml.Width)),
                    XmlConvert.ToInt32(docElement.GetAttribute(DocumentSerializationXml.Height))));
            }

			foreach(XmlElement elem in docElement.ChildNodes)
			{
				bool add=true;
				DocumentBaseContainer doc=DocumentSerializationXml.CreateDocument(elem.Name);
                context.ItemXmlElement = elem;
				if(doc is DocumentDockContainer)
					DeserializeDocumentDockContainer(context,(DocumentDockContainer)doc,deserializeDefinition);
				else if(doc is DocumentBarContainer)
                    add=DeserializeDocumentBarContainer(context,(DocumentBarContainer)doc,deserializeDefinition);
				if(add)
					instance.Documents.Add(doc);
			}
		}
コード例 #3
0
        /// <summary>
		/// Serializes the item and all sub-items into the XmlElement.
		/// </summary>
		/// <param name="ThisItem">XmlElement to serialize the item to.</param>
		protected internal virtual void Serialize(ItemSerializationContext context)
		{
            System.Xml.XmlElement ThisItem = context.ItemXmlElement;
			Type t=this.GetType();
			System.Reflection.AssemblyName aname=t.Assembly.GetName();
			if(aname.Name!="DevComponents.DotNetBar")
				ThisItem.SetAttribute("assembly",aname.Name+", PublicKeyToken="+System.Text.Encoding.ASCII.GetString(aname.GetPublicKey()));
			else
				ThisItem.SetAttribute("assembly",aname.Name);

			ThisItem.SetAttribute("class",t.FullName);

			ThisItem.SetAttribute("name",m_Name);
            ThisItem.SetAttribute("globalname", m_GlobalName);
			ThisItem.SetAttribute("text",m_Text);
			ThisItem.SetAttribute("iscontainer",System.Xml.XmlConvert.ToString(m_IsContainer));
			ThisItem.SetAttribute("visible",System.Xml.XmlConvert.ToString(m_Visible));
			if(m_ItemData!=null && m_ItemData.ToString()!="")
				ThisItem.SetAttribute("itemdata",m_ItemData.ToString());
			else
				ThisItem.SetAttribute("itemdata","");
			ThisItem.SetAttribute("enabled",System.Xml.XmlConvert.ToString(m_Enabled));
			ThisItem.SetAttribute("begingroup",System.Xml.XmlConvert.ToString(m_BeginGroup));
			ThisItem.SetAttribute("style",System.Xml.XmlConvert.ToString((int)m_Style));
			ThisItem.SetAttribute("desc",m_Description);
			ThisItem.SetAttribute("tooltip",m_Tooltip);
			ThisItem.SetAttribute("category",m_Category);
			ThisItem.SetAttribute("cancustomize",System.Xml.XmlConvert.ToString(m_CanCustomize));
			ThisItem.SetAttribute("showsubitems",System.Xml.XmlConvert.ToString(m_ShowSubItems));
			ThisItem.SetAttribute("itemalignment",System.Xml.XmlConvert.ToString((int)m_ItemAlignment));
			ThisItem.SetAttribute("stretch",System.Xml.XmlConvert.ToString(m_Stretch));
			ThisItem.SetAttribute("global",System.Xml.XmlConvert.ToString(m_GlobalItem));
			ThisItem.SetAttribute("themes",System.Xml.XmlConvert.ToString(m_ThemeAware));
			if(m_AccessibleDefaultActionDescription!="")
                ThisItem.SetAttribute("adefdesc",m_AccessibleDefaultActionDescription);
			if(m_AccessibleDescription!="")
				ThisItem.SetAttribute("adesc",m_AccessibleDescription);
			if(m_AccessibleName!="")
				ThisItem.SetAttribute("aname",m_AccessibleName);
			if(m_AccessibleRole!=System.Windows.Forms.AccessibleRole.Default)
				ThisItem.SetAttribute("arole",System.Xml.XmlConvert.ToString((int)m_AccessibleRole));
			if(!m_AutoCollapseOnClick)
				ThisItem.SetAttribute("autocollapse",System.Xml.XmlConvert.ToString(m_AutoCollapseOnClick));
			if(m_ClickAutoRepeat)
				ThisItem.SetAttribute("autorepeat",System.Xml.XmlConvert.ToString(m_ClickAutoRepeat));
			if(m_ClickRepeatInterval!=600)
				ThisItem.SetAttribute("clickrepinterv",System.Xml.XmlConvert.ToString(m_ClickRepeatInterval));
            //if(m_GenerateCommandLink)
            //    ThisItem.SetAttribute("GenerateCommandLink", System.Xml.XmlConvert.ToString(m_GenerateCommandLink));
                

			if(m_Cursor!=null)
			{
				if(m_Cursor==System.Windows.Forms.Cursors.Hand)
					ThisItem.SetAttribute("cur","4");
				else if(m_Cursor==System.Windows.Forms.Cursors.AppStarting)
					ThisItem.SetAttribute("cur","1");
				else if(m_Cursor==System.Windows.Forms.Cursors.Arrow)
					ThisItem.SetAttribute("cur","2");
				else if(m_Cursor==System.Windows.Forms.Cursors.Cross)
					ThisItem.SetAttribute("cur","3");
				else if(m_Cursor==System.Windows.Forms.Cursors.Help)
					ThisItem.SetAttribute("cur","5");
				else if(m_Cursor==System.Windows.Forms.Cursors.HSplit)
					ThisItem.SetAttribute("cur","6");
				else if(m_Cursor==System.Windows.Forms.Cursors.IBeam)
					ThisItem.SetAttribute("cur","7");
				else if(m_Cursor==System.Windows.Forms.Cursors.No)
					ThisItem.SetAttribute("cur","8");
				else if(m_Cursor==System.Windows.Forms.Cursors.NoMove2D)
					ThisItem.SetAttribute("cur","9");
				else if(m_Cursor==System.Windows.Forms.Cursors.NoMoveHoriz)
					ThisItem.SetAttribute("cur","10");
				else if(m_Cursor==System.Windows.Forms.Cursors.NoMoveVert)
					ThisItem.SetAttribute("cur","11");
				else if(m_Cursor==System.Windows.Forms.Cursors.PanEast)
					ThisItem.SetAttribute("cur","12");
				else if(m_Cursor==System.Windows.Forms.Cursors.PanNE)
					ThisItem.SetAttribute("cur","13");
				else if(m_Cursor==System.Windows.Forms.Cursors.PanNorth)
					ThisItem.SetAttribute("cur","14");
				else if(m_Cursor==System.Windows.Forms.Cursors.PanNW)
					ThisItem.SetAttribute("cur","15");
				else if(m_Cursor==System.Windows.Forms.Cursors.PanSE)
					ThisItem.SetAttribute("cur","16");
				else if(m_Cursor==System.Windows.Forms.Cursors.PanSouth)
					ThisItem.SetAttribute("cur","17");
				else if(m_Cursor==System.Windows.Forms.Cursors.PanSW)
					ThisItem.SetAttribute("cur","18");
				else if(m_Cursor==System.Windows.Forms.Cursors.PanWest)
					ThisItem.SetAttribute("cur","19");
				else if(m_Cursor==System.Windows.Forms.Cursors.SizeAll)
					ThisItem.SetAttribute("cur","20");
				else if(m_Cursor==System.Windows.Forms.Cursors.SizeNESW)
					ThisItem.SetAttribute("cur","21");
				else if(m_Cursor==System.Windows.Forms.Cursors.SizeNS)
					ThisItem.SetAttribute("cur","22");
				else if(m_Cursor==System.Windows.Forms.Cursors.SizeNWSE)
					ThisItem.SetAttribute("cur","23");
				else if(m_Cursor==System.Windows.Forms.Cursors.SizeWE)
					ThisItem.SetAttribute("cur","24");
				else if(m_Cursor==System.Windows.Forms.Cursors.UpArrow)
					ThisItem.SetAttribute("cur","25");
				else if(m_Cursor==System.Windows.Forms.Cursors.VSplit)
					ThisItem.SetAttribute("cur","26");
				else if(m_Cursor==System.Windows.Forms.Cursors.WaitCursor)
					ThisItem.SetAttribute("cur","27");
			}

			if(SubItems.Count>0 && this.ShouldSerializeSubItems())
			{
				System.Xml.XmlElement subitems=ThisItem.OwnerDocument.CreateElement("subitems");
				ThisItem.AppendChild(subitems);
				foreach(BaseItem objItem in this.SubItems)
				{
					if(objItem.ShouldSerialize)
					{
						System.Xml.XmlElement ChildItem=ThisItem.OwnerDocument.CreateElement("item");
						t=objItem.GetType();
						subitems.AppendChild(ChildItem);
                        context.ItemXmlElement = ChildItem;
						objItem.Serialize(context);
                        context.ItemXmlElement = ThisItem;
					}
				}
			}

			// Serialize Shortcuts
			if(m_Shortcuts!=null && m_Shortcuts.Count>0)
				ThisItem.SetAttribute("shortcuts",m_Shortcuts.ToString(","));

            if (context.HasSerializeItemHandlers)
            {
                System.Xml.XmlElement customData = ThisItem.OwnerDocument.CreateElement("customData");
                SerializeItemEventArgs e = new SerializeItemEventArgs(this, ThisItem, customData);
                context.Serializer.InvokeSerializeItem(e);
                if (customData.Attributes.Count > 0 || customData.ChildNodes.Count > 0)
                    ThisItem.AppendChild(customData);
            }
		}
コード例 #4
0
		protected internal override void Serialize(ItemSerializationContext context)
		{
			base.Serialize(context);
            System.Xml.XmlElement ThisItem = context.ItemXmlElement;
			ThisItem.SetAttribute("AllowResize",System.Xml.XmlConvert.ToString(m_AllowItemResize));

			if(ContainerControlSerialize!=null)
				this.ContainerControlSerialize(this,new ControlContainerSerializationEventArgs(ThisItem));
			IOwnerItemEvents owner=this.GetIOwnerItemEvents();
			if(owner!=null)
				owner.InvokeContainerControlSerialize(this,new ControlContainerSerializationEventArgs(ThisItem));

		}
コード例 #5
0
        /// <summary>
        /// Overloaded. Serializes the item and all sub-items into the XmlElement.
        /// </summary>
        /// <param name="ThisItem">XmlElement to serialize the item to.</param>
        protected internal override void Serialize(ItemSerializationContext context)
        {
            base.Serialize(context);

            System.Xml.XmlElement ThisItem = context.ItemXmlElement;

            ThisItem.SetAttribute("width", System.Xml.XmlConvert.ToString(m_Width));
            ThisItem.SetAttribute("height", System.Xml.XmlConvert.ToString(m_Height));
            ThisItem.SetAttribute("value", System.Xml.XmlConvert.ToString(m_Value));
            ThisItem.SetAttribute("min", System.Xml.XmlConvert.ToString(m_Minimum));
            ThisItem.SetAttribute("max", System.Xml.XmlConvert.ToString(m_Maximum));
            ThisItem.SetAttribute("textvisible", System.Xml.XmlConvert.ToString(m_TextVisible));
            ThisItem.SetAttribute("step", System.Xml.XmlConvert.ToString(m_Step));
            if (!m_ChunkColor.IsEmpty)
                ThisItem.SetAttribute("chunkcolor", BarFunctions.ColorToString(m_ChunkColor));
            if (!m_ChunkColor2.IsEmpty)
                ThisItem.SetAttribute("chunkcolor2", BarFunctions.ColorToString(m_ChunkColor2));
            ThisItem.SetAttribute("chunkga", System.Xml.XmlConvert.ToString(m_ChunkGradientAngle));

            if (m_BackgroundStyle.Custom)
            {
                System.Xml.XmlElement style = ThisItem.OwnerDocument.CreateElement("backstyle2");
                ThisItem.AppendChild(style);
                ElementSerializer.Serialize(m_BackgroundStyle, style);
            }

        }
コード例 #6
0
		/// <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;

			if(ItemXmlSource.HasAttribute("forecolor"))
				m_ForeColor=BarFunctions.ColorFromString(ItemXmlSource.GetAttribute("forecolor"));
			else
				m_ForeColor=Color.Empty;

//			if(ItemXmlSource.HasAttribute("backcolor"))
//				m_BackColor=BarFunctions.ColorFromString(ItemXmlSource.GetAttribute("backcolor"));
//			else
//				m_BackColor=SystemColors.Control;

			if(ItemXmlSource.HasAttribute("hotclr"))
				m_HotForeColor=BarFunctions.ColorFromString(ItemXmlSource.GetAttribute("hotclr"));
			else
				m_HotForeColor=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("itemimagesize"))
				m_ItemImageSize=(eBarImageSize)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("itemimagesize"));
			else
				m_ItemImageSize=eBarImageSize.Default;

			if(ItemXmlSource.HasAttribute("enablescrollbuttons"))
				m_EnableScrollButtons=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("enablescrollbuttons"));
			else
				m_EnableScrollButtons=true;

			// 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("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 "pressed":
							{
								m_PressedImage=BarFunctions.DeserializeImage(xmlElem2);
								m_PressedImageIndex=-1;
								break;
							}
						}
					}
					break;
				}
			}
			this.RefreshImageSize();
			NeedRecalcSize=true;
		}
コード例 #7
0
		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");
		}
コード例 #8
0
		public override void Deserialize(ItemSerializationContext context)
		{
			base.Deserialize(context);
            System.Xml.XmlElement ItemXmlSource = context.ItemXmlElement;
			if(ItemXmlSource.HasAttribute("showicons"))
				m_ShowWindowIcons=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("showicons"));
			if(ItemXmlSource.HasAttribute("mdiaccesskey"))
				m_CreateMdiChildAccessKeys=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("mdiaccesskey"));
			if(!m_Initialized)
				Initialize();
		}
コード例 #9
0
		protected internal override void Serialize(ItemSerializationContext context)
		{
			base.Serialize(context);
            System.Xml.XmlElement ThisItem = context.ItemXmlElement;
			if(!m_ShowWindowIcons)
                ThisItem.SetAttribute("showicons",System.Xml.XmlConvert.ToString(m_ShowWindowIcons));
			if(m_CreateMdiChildAccessKeys)
                ThisItem.SetAttribute("mdiaccesskey",System.Xml.XmlConvert.ToString(m_CreateMdiChildAccessKeys));
		}
コード例 #10
0
		/// <summary>
		/// Overloaded. Serializes the item and all sub-items into the XmlElement.
		/// </summary>
		/// <param name="ThisItem">XmlElement to serialize the item to.</param>
		protected internal override void Serialize(ItemSerializationContext context)
		{
			base.Serialize(context);
            System.Xml.XmlElement ThisItem = context.ItemXmlElement;
			if(!m_CustomizeItemVisible)
				ThisItem.SetAttribute("customizeitemvisible",System.Xml.XmlConvert.ToString(m_CustomizeItemVisible));
		}
コード例 #11
0
		/// <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;
			if(ItemXmlSource.HasAttribute("customizeitemvisible"))
				m_CustomizeItemVisible=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("customizeitemvisible"));
		}
コード例 #12
0
		internal void Deserialize(System.Xml.XmlElement xmlThisBar)
		{
            // Creates serialization context
            ItemSerializationContext context = new ItemSerializationContext();
            context.Serializer = this;
            context.HasDeserializeItemHandlers = ((ICustomSerialization)this).HasDeserializeItemHandlers;
            context.HasSerializeItemHandlers = ((ICustomSerialization)this).HasSerializeItemHandlers;

			m_ShortcutTable.Clear();

			this.Name=xmlThisBar.GetAttribute("name");
			//m_ItemContainer.Style=(eDotNetBarStyle)System.Xml.XmlConvert.ToInt32(xmlThisBar.GetAttribute("style"));
			
//			if(xmlThisBar.HasAttribute("backcolor"))
//				this.BackColor=BarFunctions.ColorFromString(xmlThisBar.GetAttribute("backcolor"));
//			if(xmlThisBar.HasAttribute("forecolor"))
//				this.ForeColor=BarFunctions.ColorFromString(xmlThisBar.GetAttribute("forecolor"));

			//this.Location=new Point(System.Xml.XmlConvert.ToInt32(xmlThisBar.GetAttribute("x")),System.Xml.XmlConvert.ToInt32(xmlThisBar.GetAttribute("y")));
			this.Size=new Size(System.Xml.XmlConvert.ToInt32(xmlThisBar.GetAttribute("width")),System.Xml.XmlConvert.ToInt32(xmlThisBar.GetAttribute("height")));
			
			if(xmlThisBar.HasAttribute("animate"))
				m_AnimationEnabled=System.Xml.XmlConvert.ToBoolean(xmlThisBar.GetAttribute("animate"));
			else
				m_AnimationEnabled=true;

			// Load font information if it exists
			if(xmlThisBar.HasAttribute("fontname"))
			{
				string FontName=xmlThisBar.GetAttribute("fontname");
				float FontSize=System.Xml.XmlConvert.ToSingle(xmlThisBar.GetAttribute("fontemsize"));
				System.Drawing.FontStyle FontStyle=(System.Drawing.FontStyle)System.Xml.XmlConvert.ToInt32(xmlThisBar.GetAttribute("fontstyle"));
				try
				{
					this.Font=new Font(FontName,FontSize,FontStyle);
				}
				catch(Exception)
				{
                    this.Font = SystemFonts.DefaultFont;
				}
			}

			foreach(System.Xml.XmlElement xmlElem in xmlThisBar.ChildNodes)
			{
				switch(xmlElem.Name)
				{
					case "items":
					{
						foreach(System.Xml.XmlElement xmlItem in xmlElem.ChildNodes)
						{
							BaseItem objItem=BarFunctions.CreateItemFromXml(xmlItem);
							m_ItemContainer.SubItems.Add(objItem);
                            context.ItemXmlElement = xmlItem;
							objItem.Deserialize(context);
						}
						break;
					}
					case "backstyle":
                        DeserializeElementStyle(m_BackStyle, xmlElem);
						m_VisualPropertyChanged=true;
						break;
				}
			}
		}
コード例 #13
0
		internal void Serialize(System.Xml.XmlElement xmlThisBar)
		{
            // Creates serialization context
            ItemSerializationContext context = new ItemSerializationContext();
            context.Serializer = this;
            context.HasDeserializeItemHandlers = ((ICustomSerialization)this).HasDeserializeItemHandlers;
            context.HasSerializeItemHandlers = ((ICustomSerialization)this).HasSerializeItemHandlers;

			xmlThisBar.SetAttribute("name",this.Name);
			
			// Save Font information if needed
			if(this.Font!=null)
			{
				if(this.Font.Name!=System.Windows.Forms.SystemInformation.MenuFont.Name || this.Font.Size!=System.Windows.Forms.SystemInformation.MenuFont.Size || this.Font.Style!=System.Windows.Forms.SystemInformation.MenuFont.Style)
				{
					xmlThisBar.SetAttribute("fontname",this.Font.Name);
					xmlThisBar.SetAttribute("fontemsize",System.Xml.XmlConvert.ToString(this.Font.Size));
					xmlThisBar.SetAttribute("fontstyle",System.Xml.XmlConvert.ToString((int)this.Font.Style));
				}
			}

//			if(this.BackColor!=SystemColors.Control)
//				xmlThisBar.SetAttribute("backcolor",BarFunctions.ColorToString(this.BackColor));
//			if(this.ForeColor!=SystemColors.ControlText)
//				xmlThisBar.SetAttribute("forecolor",BarFunctions.ColorToString(this.ForeColor));

			//xmlThisBar.SetAttribute("x",System.Xml.XmlConvert.ToString(this.Location.X));
			//xmlThisBar.SetAttribute("y",System.Xml.XmlConvert.ToString(this.Location.Y));
			xmlThisBar.SetAttribute("width",System.Xml.XmlConvert.ToString(this.Width));
			xmlThisBar.SetAttribute("height",System.Xml.XmlConvert.ToString(this.Height));
			if(!m_AnimationEnabled)
				xmlThisBar.SetAttribute("animate",System.Xml.XmlConvert.ToString(m_AnimationEnabled));
			System.Xml.XmlElement xmlItems=xmlThisBar.OwnerDocument.CreateElement("items");
			xmlThisBar.AppendChild(xmlItems);
			foreach(BaseItem objItem in m_ItemContainer.SubItems)
			{
				if(objItem.ShouldSerialize)
				{
					System.Xml.XmlElement xmlItem=xmlThisBar.OwnerDocument.CreateElement("item");
					xmlItems.AppendChild(xmlItem);
                    context.ItemXmlElement = xmlItem;
					objItem.Serialize(context);
				}
			}

			System.Xml.XmlElement xmlStyle=xmlThisBar.OwnerDocument.CreateElement("backstyle");
			xmlThisBar.AppendChild(xmlStyle);
            SerializeElementStyle(m_BackStyle,xmlStyle);
		}
コード例 #14
0
		public override void Deserialize(ItemSerializationContext context)
		{
			base.Deserialize(context);

            System.Xml.XmlElement ItemXmlSource = context.ItemXmlElement;

			m_BorderType=(eBorderType)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("bt"));

            if (ItemXmlSource.HasAttribute("BorderSide"))
                m_BorderSide = (eBorderSide)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("BorderSide"));
            else
                m_BorderSide = DEFAULT_BORDERSIDE;

			if(ItemXmlSource.HasAttribute("bc"))
                m_BackColor=BarFunctions.ColorFromString(ItemXmlSource.GetAttribute("bc"));
			else
				m_BackColor=Color.Empty;
			m_ForeColor=BarFunctions.ColorFromString(ItemXmlSource.GetAttribute("fc"));

            if (ItemXmlSource.HasAttribute("sc"))
            {
                m_SingleLineColor = BarFunctions.ColorFromString(ItemXmlSource.GetAttribute("sc"));
                if (m_SingleLineColor != SystemColors.ControlDark)
                    m_SingleLineColorCustom = true;
            }
            else
            {
                m_SingleLineColorCustom = false;
                m_SingleLineColor = SystemColors.ControlDark;
            }

			m_TextAlignment=(StringAlignment)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("ta"));
			m_TextLineAlignment=(StringAlignment)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("tla"));

			m_DividerStyle=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("ds"));

            m_PaddingLeft=System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("pl"));
			m_PaddingRight=System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("pr"));
			m_PaddingTop=System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("pt"));
			m_PaddingBottom=System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("pb"));

			m_Width=System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("w"));
			m_Height=System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("h"));

			// Load font information if it exists
			if(ItemXmlSource.HasAttribute("fontname"))
			{
				string FontName=ItemXmlSource.GetAttribute("fontname");
				float FontSize=System.Xml.XmlConvert.ToSingle(ItemXmlSource.GetAttribute("fontemsize"));
				System.Drawing.FontStyle FontStyle=(System.Drawing.FontStyle)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("fontstyle"));
				try
				{
					this.Font=new Font(FontName,FontSize,FontStyle);
				}
				catch(Exception)
				{
                    this.Font = SystemFonts.DefaultFont; // System.Windows.Forms.SystemInformation.MenuFont.Clone() as Font;
				}
			}

			// 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"));

					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;
							}
						}
					}
					break;
				}
			}
		}
コード例 #15
0
		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"));
		}
コード例 #16
0
        /// <summary>
        /// Overloaded. Serializes the item and all sub-items into the XmlElement.
        /// </summary>
        /// <param name="ThisItem">XmlElement to serialize the item to.</param>
        protected internal override void Serialize(ItemSerializationContext context)
        {
            base.Serialize(context);
            System.Xml.XmlElement ThisItem = context.ItemXmlElement;
            ThisItem.SetAttribute("ImagePosition", System.Xml.XmlConvert.ToString(((int)m_ImagePosition)));
            ThisItem.SetAttribute("ButtonStyle", System.Xml.XmlConvert.ToString(((int)m_ButtonStyle)));
            ThisItem.SetAttribute("Checked", System.Xml.XmlConvert.ToString(m_Checked));
            ThisItem.SetAttribute("VerticalPadding", System.Xml.XmlConvert.ToString(m_VerticalPadding));
            ThisItem.SetAttribute("HorizontalPadding", System.Xml.XmlConvert.ToString(m_HorizontalPadding));

            ThisItem.SetAttribute("MenuVisibility", System.Xml.XmlConvert.ToString((int)m_MenuVisibility));
            ThisItem.SetAttribute("RecentlyUsed", System.Xml.XmlConvert.ToString(m_RecentlyUsed));

            if (m_AlternateShortcutText != "")
                ThisItem.SetAttribute("AlternateShortcutText", m_AlternateShortcutText);

            if (!m_ForeColor.IsEmpty)
                ThisItem.SetAttribute("forecolor", BarFunctions.ColorToString(m_ForeColor));

            if (m_HotTrackingStyle != eHotTrackingStyle.Default)
                ThisItem.SetAttribute("hottrack", System.Xml.XmlConvert.ToString((int)m_HotTrackingStyle));

            if (m_HotFontBold)
                ThisItem.SetAttribute("hotfb", System.Xml.XmlConvert.ToString(m_HotFontBold));
            if (m_HotFontUnderline)
                ThisItem.SetAttribute("hotfu", System.Xml.XmlConvert.ToString(m_HotFontUnderline));

            if (!m_HotForeColor.IsEmpty)
                ThisItem.SetAttribute("hotclr", BarFunctions.ColorToString(m_HotForeColor));

            if (m_OptionGroup != "")
                ThisItem.SetAttribute("optiongroup", m_OptionGroup);

            if (m_FontBold)
                ThisItem.SetAttribute("fontbold", System.Xml.XmlConvert.ToString(m_FontBold));
            if (m_FontItalic)
                ThisItem.SetAttribute("fontitalic", System.Xml.XmlConvert.ToString(m_FontItalic));
            if (m_FontUnderline)
                ThisItem.SetAttribute("fontunderline", System.Xml.XmlConvert.ToString(m_FontUnderline));

            if (m_AutoExpandOnClick)
                ThisItem.SetAttribute("autoexpandclick", System.Xml.XmlConvert.ToString(m_AutoExpandOnClick));

            if (m_CustomColorName != "")
                ThisItem.SetAttribute("CustomColorName", m_CustomColorName);
            if (m_ColorTable != eButtonColor.Orange)
                ThisItem.SetAttribute("ColorTable", Enum.GetName(m_ColorTable.GetType(), m_ColorTable));

            System.Xml.XmlElement xmlElem = null, xmlElem2 = null;

            // Serialize Images
            if (m_Image != null || m_ImageIndex >= 0 || m_HoverImage != null || m_HoverImageIndex >= 0 || m_DisabledImage != null || m_DisabledImageIndex >= 0 || m_PressedImage != null || m_PressedImageIndex >= 0 || m_Icon != null || m_ImageSmall != null)
            {
                xmlElem = ThisItem.OwnerDocument.CreateElement("images");
                ThisItem.AppendChild(xmlElem);

                if (m_ImageIndex >= 0)
                    xmlElem.SetAttribute("imageindex", System.Xml.XmlConvert.ToString(m_ImageIndex));
                if (m_HoverImageIndex >= 0)
                    xmlElem.SetAttribute("hoverimageindex", System.Xml.XmlConvert.ToString(m_HoverImageIndex));
                if (m_DisabledImageIndex >= 0)
                    xmlElem.SetAttribute("disabledimageindex", System.Xml.XmlConvert.ToString(m_DisabledImageIndex));
                if (m_PressedImageIndex >= 0)
                    xmlElem.SetAttribute("pressedimageindex", System.Xml.XmlConvert.ToString(m_PressedImageIndex));

                if (m_Image != null)
                {
                    xmlElem2 = ThisItem.OwnerDocument.CreateElement("image");
                    xmlElem2.SetAttribute("type", "default");
                    xmlElem.AppendChild(xmlElem2);
                    BarFunctions.SerializeImage(m_Image, xmlElem2);
                }
                if (m_ImageSmall != null)
                {
                    xmlElem2 = ThisItem.OwnerDocument.CreateElement("imagesmall");
                    xmlElem2.SetAttribute("type", "small");
                    xmlElem.AppendChild(xmlElem2);
                    BarFunctions.SerializeImage(m_ImageSmall, xmlElem2);
                }
                if (m_HoverImage != null)
                {
                    xmlElem2 = ThisItem.OwnerDocument.CreateElement("image");
                    xmlElem2.SetAttribute("type", "hover");
                    xmlElem.AppendChild(xmlElem2);
                    BarFunctions.SerializeImage(m_HoverImage, xmlElem2);
                }
                if (m_DisabledImage != null && m_DisabledImageCustom)
                {
                    xmlElem2 = ThisItem.OwnerDocument.CreateElement("image");
                    xmlElem2.SetAttribute("type", "disabled");
                    xmlElem.AppendChild(xmlElem2);
                    BarFunctions.SerializeImage(m_DisabledImage, xmlElem2);
                }
                if (m_PressedImage != null)
                {
                    xmlElem2 = ThisItem.OwnerDocument.CreateElement("image");
                    xmlElem2.SetAttribute("type", "pressed");
                    xmlElem.AppendChild(xmlElem2);
                    BarFunctions.SerializeImage(m_PressedImage, xmlElem2);
                }
                if (m_Icon != null)
                {
                    xmlElem2 = ThisItem.OwnerDocument.CreateElement("image");
                    xmlElem2.SetAttribute("type", "icon");
                    xmlElem.AppendChild(xmlElem2);
                    BarFunctions.SerializeIcon(m_Icon, xmlElem2);
                }
            }
        }
コード例 #17
0
		/// <summary>
		/// Overloaded. Serializes the item and all sub-items into the XmlElement.
		/// </summary>
		/// <param name="ThisItem">XmlElement to serialize the item to.</param>
		protected internal override void Serialize(ItemSerializationContext context)
		{
			base.Serialize(context);
            System.Xml.XmlElement ThisItem = context.ItemXmlElement;
			if(m_ForeColor!=SystemColors.ControlText && !m_ForeColor.IsEmpty)
				ThisItem.SetAttribute("forecolor",BarFunctions.ColorToString(m_ForeColor));

//			if(m_BackColor!=SystemColors.Control)
//				ThisItem.SetAttribute("backcolor",BarFunctions.ColorToString(m_BackColor));

			if(m_HotFontBold)
				ThisItem.SetAttribute("hotfb",System.Xml.XmlConvert.ToString(m_HotFontBold));

			if(m_HotFontUnderline)
				ThisItem.SetAttribute("hotfu",System.Xml.XmlConvert.ToString(m_HotFontUnderline));

			if(!m_HotForeColor.IsEmpty)
				ThisItem.SetAttribute("hotclr",BarFunctions.ColorToString(m_HotForeColor));

			if(m_ItemImageSize!=eBarImageSize.Default)
				ThisItem.SetAttribute("itemimagesize",System.Xml.XmlConvert.ToString((int)m_ItemImageSize));

			if(!m_EnableScrollButtons)
				ThisItem.SetAttribute("enablescrollbuttons",System.Xml.XmlConvert.ToString(m_EnableScrollButtons));

			// Serialize Images
			System.Xml.XmlElement xmlElem=null, xmlElem2=null;
			if(m_Image!=null || m_ImageIndex>=0 || m_HoverImage!=null || m_HoverImageIndex>=0 || m_PressedImage!=null || m_PressedImageIndex>=0 || m_Icon!=null)
			{
				xmlElem=ThisItem.OwnerDocument.CreateElement("images");
				ThisItem.AppendChild(xmlElem);

				if(m_ImageIndex>=0)
					xmlElem.SetAttribute("imageindex",System.Xml.XmlConvert.ToString(m_ImageIndex));
				if(m_HoverImageIndex>=0)
					xmlElem.SetAttribute("hoverimageindex",System.Xml.XmlConvert.ToString(m_HoverImageIndex));
				if(m_PressedImageIndex>=0)
					xmlElem.SetAttribute("pressedimageindex",System.Xml.XmlConvert.ToString(m_PressedImageIndex));

				if(m_Image!=null)
				{
					xmlElem2=ThisItem.OwnerDocument.CreateElement("image");
					xmlElem2.SetAttribute("type","default");
					xmlElem.AppendChild(xmlElem2);
					BarFunctions.SerializeImage(m_Image,xmlElem2);
				}
				if(m_HoverImage!=null)
				{
					xmlElem2=ThisItem.OwnerDocument.CreateElement("image");
					xmlElem2.SetAttribute("type","hover");
					xmlElem.AppendChild(xmlElem2);
					BarFunctions.SerializeImage(m_HoverImage,xmlElem2);
				}
				if(m_PressedImage!=null)
				{
					xmlElem2=ThisItem.OwnerDocument.CreateElement("image");
					xmlElem2.SetAttribute("type","pressed");
					xmlElem.AppendChild(xmlElem2);
					BarFunctions.SerializeImage(m_PressedImage,xmlElem2);
				}
				if(m_Icon!=null)
				{
					xmlElem2=ThisItem.OwnerDocument.CreateElement("image");
					xmlElem2.SetAttribute("type","icon");
					xmlElem.AppendChild(xmlElem2);
					BarFunctions.SerializeIcon(m_Icon,xmlElem2);
				}
			}
		}
コード例 #18
0
        /// <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();
        }
コード例 #19
0
		protected internal override void Serialize(ItemSerializationContext context)
		{
			base.Serialize(context);
            System.Xml.XmlElement ThisItem = context.ItemXmlElement;
			ThisItem.SetAttribute("ComboWidth",System.Xml.XmlConvert.ToString(m_ComboWidth));
			ThisItem.SetAttribute("FontCombo",System.Xml.XmlConvert.ToString(m_FontCombo));

			ThisItem.SetAttribute("MenuVisibility",System.Xml.XmlConvert.ToString((int)m_MenuVisibility));
			ThisItem.SetAttribute("RecentlyUsed",System.Xml.XmlConvert.ToString(m_RecentlyUsed));
			ThisItem.SetAttribute("DropDownStyle",System.Xml.XmlConvert.ToString((int)m_ComboBox.DropDownStyle));
			//ThisItem.SetAttribute("CText",m_ControlText);
			ThisItem.SetAttribute("ThemeAware",System.Xml.XmlConvert.ToString(m_ComboBox.ThemeAware));

			ThisItem.SetAttribute("AlwaysShowCaption",System.Xml.XmlConvert.ToString(m_AlwaysShowCaption));
			ThisItem.SetAttribute("ItemHeight",System.Xml.XmlConvert.ToString(m_ComboBox.ItemHeight));

            if(m_ComboBox.DisplayMember!="")
                ThisItem.SetAttribute("DisplayMembers", m_ComboBox.DisplayMember);

			if(m_PreventEnterBeep)
				ThisItem.SetAttribute("nobeep",System.Xml.XmlConvert.ToString(m_PreventEnterBeep));
			
			if(!m_FontCombo && m_ComboBox.Items.Count>0)
			{
				System.Xml.XmlElement xmlItems=ThisItem.OwnerDocument.CreateElement("cbitems");
				ThisItem.AppendChild(xmlItems);
				foreach(object item in m_ComboBox.Items)
				{
					DevComponents.Editors.ComboItem ci=item as DevComponents.Editors.ComboItem;
					if(ci!=null)
					{
						System.Xml.XmlElement xmlChild=ThisItem.OwnerDocument.CreateElement("ci");

						if(!ci.BackColor.IsEmpty)
							xmlChild.SetAttribute("bc",BarFunctions.ColorToString(ci.BackColor));
						if(ci.FontName!="")
							xmlChild.SetAttribute("fn",ci.FontName);
						if(ci.FontSize!=8)
							xmlChild.SetAttribute("fs",System.Xml.XmlConvert.ToString(ci.FontSize));
						
						xmlChild.SetAttribute("fy",System.Xml.XmlConvert.ToString((int)ci.FontStyle));

						if(!ci.ForeColor.IsEmpty)
							xmlChild.SetAttribute("fc",BarFunctions.ColorToString(ci.ForeColor));

						BarFunctions.SerializeImage(ci.Image,xmlChild);

						if(ci.ImageIndex>=0)
							xmlChild.SetAttribute("img",System.Xml.XmlConvert.ToString(ci.ImageIndex));

						if(ci.ImagePosition!=System.Windows.Forms.HorizontalAlignment.Left)
							xmlChild.SetAttribute("ip",System.Xml.XmlConvert.ToString((int)ci.ImagePosition));
						
						xmlChild.SetAttribute("text",ci.Text);

						xmlChild.SetAttribute("ta",System.Xml.XmlConvert.ToString((int)ci.TextAlignment));
						xmlChild.SetAttribute("tla",System.Xml.XmlConvert.ToString((int)ci.TextLineAlignment));
						
						if(m_ComboBox.SelectedItem==item)
							xmlChild.SetAttribute("selected","1");

						xmlItems.AppendChild(xmlChild);
					}
					else
					{
						System.Xml.XmlElement xmlChild=ThisItem.OwnerDocument.CreateElement("co");
						xmlChild.InnerText=item.ToString();
						xmlItems.AppendChild(xmlChild);

						if(m_ComboBox.SelectedItem==item)
							xmlChild.SetAttribute("selected","1");
					}	
				}
			}
		}
コード例 #20
0
		/// <summary>
		/// Overloaded. Serializes the item and all sub-items into the XmlElement.
		/// </summary>
		/// <param name="ThisItem">XmlElement to serialize the item to.</param>
		protected internal override void Serialize(ItemSerializationContext context)
		{
			base.Serialize(context);

            System.Xml.XmlElement groupItem = context.ItemXmlElement;

			groupItem.SetAttribute("stockstyle",System.Xml.XmlConvert.ToString((int)m_StockStyle));
			groupItem.SetAttribute("expvisible",System.Xml.XmlConvert.ToString(m_ExpandButtonVisible));
			groupItem.SetAttribute("subitemsmargin",System.Xml.XmlConvert.ToString(m_SubItemsMargin));
			groupItem.SetAttribute("xpspecial",System.Xml.XmlConvert.ToString(m_XPSpecialGroup));
			
			groupItem.SetAttribute("expborder",BarFunctions.ColorToString(m_ExpandBorderColor));
			groupItem.SetAttribute("expbc",BarFunctions.ColorToString(m_ExpandBackColor));
			groupItem.SetAttribute("expfc",BarFunctions.ColorToString(m_ExpandForeColor));
			groupItem.SetAttribute("exphborder",BarFunctions.ColorToString(m_ExpandHotBorderColor));
			groupItem.SetAttribute("exphbc",BarFunctions.ColorToString(m_ExpandHotBackColor));
			groupItem.SetAttribute("exphfc",BarFunctions.ColorToString(m_ExpandHotForeColor));

			groupItem.SetAttribute("headerexp",System.Xml.XmlConvert.ToString(m_HeaderExpands));

			groupItem.SetAttribute("expanded",System.Xml.XmlConvert.ToString(m_Expanded));

			if(m_StockStyle==eExplorerBarStockStyle.Custom)
			{
				System.Xml.XmlElement style=groupItem.OwnerDocument.CreateElement("backstyle");
				groupItem.AppendChild(style);
				//m_BackgroundStyle.Serialize(style);
                SerializeElementStyle(m_BackStyle, style);
			}

			if(m_StockStyle==eExplorerBarStockStyle.Custom)
			{
				System.Xml.XmlElement style=groupItem.OwnerDocument.CreateElement("headerhotstyle");
				groupItem.AppendChild(style);
				//m_HeaderHotStyle.Serialize(style);
                SerializeElementStyle(m_TitleHotStyle, style);
			}

			if(m_StockStyle==eExplorerBarStockStyle.Custom)
			{
				System.Xml.XmlElement style=groupItem.OwnerDocument.CreateElement("headerstyle");
				groupItem.AppendChild(style);
				//m_HeaderStyle.Serialize(style);
                SerializeElementStyle(m_TitleStyle, style);
			}

			if(m_ImageIndex!=-1)
			{
				groupItem.SetAttribute("imageindex",System.Xml.XmlConvert.ToString(m_ImageIndex));
			}
			else if(m_Image!=null)
			{
                System.Xml.XmlElement image=groupItem.OwnerDocument.CreateElement("image");
				groupItem.AppendChild(image);
                BarFunctions.SerializeImage(m_Image,image);
			}
		}
コード例 #21
0
		public override void Deserialize(ItemSerializationContext context)
		{
			base.Deserialize(context);
            System.Xml.XmlElement ItemXmlSource = context.ItemXmlElement;
			m_AllowItemResize=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("AllowResize"));
			InitControl();

			if(ContainerControlDeserialize!=null)
				this.ContainerControlDeserialize(this,new ControlContainerSerializationEventArgs(ItemXmlSource));
			IOwnerItemEvents owner=this.GetIOwnerItemEvents();
			if(owner!=null)
				owner.InvokeContainerControlDeserialize(this,new ControlContainerSerializationEventArgs(ItemXmlSource));
		}
コード例 #22
0
		/// <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 groupItem = context.ItemXmlElement;

			m_StockStyle=(eExplorerBarStockStyle)System.Xml.XmlConvert.ToInt32(groupItem.GetAttribute("stockstyle"));
			m_ExpandButtonVisible=System.Xml.XmlConvert.ToBoolean(groupItem.GetAttribute("expvisible"));
			m_SubItemsMargin=System.Xml.XmlConvert.ToInt32(groupItem.GetAttribute("subitemsmargin"));
			m_XPSpecialGroup=System.Xml.XmlConvert.ToBoolean(groupItem.GetAttribute("xpspecial"));

		
			m_ExpandBorderColor=BarFunctions.ColorFromString(groupItem.GetAttribute("expborder"));
			m_ExpandBackColor=BarFunctions.ColorFromString(groupItem.GetAttribute("expbc"));
			m_ExpandForeColor=BarFunctions.ColorFromString(groupItem.GetAttribute("expfc"));
			m_ExpandHotBorderColor=BarFunctions.ColorFromString(groupItem.GetAttribute("exphborder"));
			m_ExpandHotBackColor=BarFunctions.ColorFromString(groupItem.GetAttribute("exphbc"));
			m_ExpandHotForeColor=BarFunctions.ColorFromString(groupItem.GetAttribute("exphfc"));
			
			m_HeaderExpands=System.Xml.XmlConvert.ToBoolean(groupItem.GetAttribute("headerexp"));

			foreach(System.Xml.XmlElement xmlElem in groupItem.ChildNodes)
			{
				switch(xmlElem.Name)
				{
					case "backstyle":
						DeserializeElementStyle(m_BackStyle,xmlElem);
						break;
					case "headerhotstyle":
                        DeserializeElementStyle(m_TitleHotStyle, xmlElem);
						break;
					case "headerstyle":
                        DeserializeElementStyle(m_TitleStyle, xmlElem);
						break;
					case "image":
						m_Image=BarFunctions.DeserializeImage(xmlElem);
						break;
				}
			}

			if(groupItem.HasAttribute("imageindex"))
			{
				this.ImageIndex=System.Xml.XmlConvert.ToInt32(groupItem.GetAttribute("imageindex"));
			}

			this.RefreshImageSize();
			
			this.Expanded=System.Xml.XmlConvert.ToBoolean(groupItem.GetAttribute("expanded"));
		}
コード例 #23
0
        /// <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_Width = System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("width"));
            m_Height = System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("height"));
            m_Value = System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("value"));
            m_Minimum = System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("min"));
            m_Maximum = System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("max"));
            m_TextVisible = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("textvisible"));
            m_Step = System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("step"));
            if (ItemXmlSource.HasAttribute("chunkcolor"))
                m_ChunkColor = BarFunctions.ColorFromString(ItemXmlSource.GetAttribute("chunkcolor"));
            if (ItemXmlSource.HasAttribute("chunkcolor2"))
                m_ChunkColor2 = BarFunctions.ColorFromString(ItemXmlSource.GetAttribute("chunkcolor2"));
            m_ChunkGradientAngle = System.Xml.XmlConvert.ToSingle(ItemXmlSource.GetAttribute("chunkga"));

            foreach (System.Xml.XmlElement xmlElem in ItemXmlSource.ChildNodes)
            {
                switch (xmlElem.Name)
                {
                    case "backstyle2":
                        {
                            ElementSerializer.Deserialize(m_BackgroundStyle, xmlElem);
                            break;
                        }
                }
            }
        }
コード例 #24
0
		protected internal override void Serialize(ItemSerializationContext context)
		{
			base.Serialize(context);
            System.Xml.XmlElement ThisItem = context.ItemXmlElement;
			System.Xml.XmlElement xmlElem=null, xmlElem2=null;
			// Serialize Images
			if(m_Image!=null || m_ImageIndex>=0)
			{
				xmlElem=ThisItem.OwnerDocument.CreateElement("images");
				ThisItem.AppendChild(xmlElem);

				if(m_ImageIndex>=0)
					xmlElem.SetAttribute("imageindex",System.Xml.XmlConvert.ToString(m_ImageIndex));

				if(m_Image!=null)
				{
					xmlElem2=ThisItem.OwnerDocument.CreateElement("image");
					xmlElem2.SetAttribute("type","default");
					xmlElem.AppendChild(xmlElem2);
					BarFunctions.SerializeImage(m_Image,xmlElem2);
				}
			}
			else if(m_Icon!=null)
			{
				xmlElem=ThisItem.OwnerDocument.CreateElement("images");
				ThisItem.AppendChild(xmlElem);

				xmlElem2=ThisItem.OwnerDocument.CreateElement("image");
				xmlElem2.SetAttribute("type","icon");
				xmlElem.AppendChild(xmlElem2);
				BarFunctions.SerializeIcon(m_Icon,xmlElem2);
			}

			if(m_MinimumSize.Width!=32 || m_MinimumSize.Height!=32)
			{
				ThisItem.SetAttribute("minw",m_MinimumSize.Width.ToString());
				ThisItem.SetAttribute("minh",m_MinimumSize.Height.ToString());
			}

			if(m_DefaultFloatingSize.Width!=128 || m_DefaultFloatingSize.Height!=128)
			{
				ThisItem.SetAttribute("defw",m_DefaultFloatingSize.Width.ToString());
				ThisItem.SetAttribute("defh",m_DefaultFloatingSize.Height.ToString());
			}

			if(m_MinFormClientSize!=64)
			{
				ThisItem.SetAttribute("csize",m_MinFormClientSize.ToString());
			}

            if(m_PredefinedTabColor!=eTabItemColor.Default)
                ThisItem.SetAttribute("PredefinedTabColor", System.Xml.XmlConvert.ToString(((int)m_PredefinedTabColor)));


			if(ContainerControlSerialize!=null)
				this.ContainerControlSerialize(this,new ControlContainerSerializationEventArgs(ThisItem));
			IOwnerItemEvents owner=this.GetIOwnerItemEvents();
			if(owner!=null)
				owner.InvokeContainerControlSerialize(this,new ControlContainerSerializationEventArgs(ThisItem));

		}
コード例 #25
0
		internal void DeserializeDefinition(ItemSerializationContext context)
		{
            XmlElement parent = context.ItemXmlElement;
            if ((parent.Name != DocumentSerializationXml.Documents && parent.Name != DocumentSerializationXml.DockSite) || m_LoadingLayout)
				return;

			m_LoadingLayout=true;
			try
			{
				foreach(XmlElement elem in parent.ChildNodes)
				{
					if(elem.Name==DocumentSerializationXml.DockContainer)
					{
                        context.ItemXmlElement = elem;
						DeserializeDocumentDockContainer(context,m_DocumentDockContainer,true);
						break;
					}
				}

                if (parent.HasAttribute(DocumentSerializationXml.DockSiteSize))
                {
                    if (m_Container.Dock == DockStyle.Left || m_Container.Dock == DockStyle.Right)
                        m_Container.Width = XmlConvert.ToInt32(parent.GetAttribute(DocumentSerializationXml.DockSiteSize));
                    else if (m_Container.Dock == DockStyle.Top || m_Container.Dock == DockStyle.Bottom)
                        m_Container.Height = XmlConvert.ToInt32(parent.GetAttribute(DocumentSerializationXml.DockSiteSize));
                }
			}
			finally
			{
				m_LoadingLayout=false;
			}
			m_Container.RecalcLayout();
		}
コード例 #26
0
		public override void Deserialize(ItemSerializationContext context)
		{
			base.Deserialize(context);

            System.Xml.XmlElement ItemXmlSource = context.ItemXmlElement;

			// 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"));

					foreach(System.Xml.XmlElement xmlElem2 in xmlElem.ChildNodes)
					{
						if(xmlElem2.GetAttribute("type")=="default")
						{
							m_Image=BarFunctions.DeserializeImage(xmlElem2);
							m_ImageIndex=-1;
						}
						else if(xmlElem2.GetAttribute("type")=="icon")
						{
							m_Icon=BarFunctions.DeserializeIcon(xmlElem2);
							m_ImageIndex=-1;
						}
					}
					break;
				}
			}

			if(ItemXmlSource.HasAttribute("minw"))
			{
				m_MinimumSize=new Size(System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("minw")),System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("minh")));
			}

			if(ItemXmlSource.HasAttribute("defw"))
			{
				m_DefaultFloatingSize=new Size(System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("defw")),System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("defh")));
			}

			if(ItemXmlSource.HasAttribute("csize"))
				m_MinFormClientSize=System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("csize"));
			else
				m_MinFormClientSize=64;

            if (ItemXmlSource.HasAttribute("PredefinedTabColor"))
                m_PredefinedTabColor = (eTabItemColor)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("PredefinedTabColor"));
            else
                m_PredefinedTabColor = eTabItemColor.Default;

			InitControl();

            if (m_Control == null && context.DockControls != null && context.DockControls.ContainsKey(this.Name))
            {
                this.Control = context.DockControls[this.Name] as System.Windows.Forms.Control;
                context.DockControls.Remove(this.Name);
            }

			if(ContainerControlDeserialize!=null)
				this.ContainerControlDeserialize(this,new ControlContainerSerializationEventArgs(ItemXmlSource));
			IOwnerItemEvents owner=this.GetIOwnerItemEvents();
			if(owner!=null)
				owner.InvokeContainerControlDeserialize(this,new ControlContainerSerializationEventArgs(ItemXmlSource));
		}
コード例 #27
0
		private bool DeserializeDocumentBarContainer(ItemSerializationContext context, DocumentBarContainer instance, bool deserializeDefinition)
		{
            XmlElement docElement = context.ItemXmlElement;
			if(docElement.Name!=DocumentSerializationXml.BarContainer)
				return false;
			
			instance.SetLayoutBounds(new Rectangle(0,0,XmlConvert.ToInt32(docElement.GetAttribute(DocumentSerializationXml.Width)),XmlConvert.ToInt32(docElement.GetAttribute(DocumentSerializationXml.Height))));
			
			foreach(XmlElement elem in docElement.ChildNodes)
			{
				if(elem.Name==BarSerializationXml.Bar)
				{
					instance.Bar=m_Container.Owner.Bars[elem.GetAttribute(BarSerializationXml.Name)];
					if(deserializeDefinition || instance.Bar==null && elem.HasAttribute(BarSerializationXml.Custom) && XmlConvert.ToBoolean(elem.GetAttribute(BarSerializationXml.Custom)))
					{
						// New bar that user has created try to deserialize but if it does not have items ignore it
						instance.Bar=new Bar();
						m_Container.Owner.Bars.Add(instance.Bar);
						if(deserializeDefinition)
							instance.Bar.Deserialize(elem, context);
						else
							instance.Bar.DeserializeLayout(elem);
						if(instance.Bar.Items.Count==0 && !deserializeDefinition)
						{
							m_Container.Owner.Bars.Remove(instance.Bar);
							return false;
						}
						return true;
					}

                    if (instance.Bar != null)
                    {
                        instance.Bar.DeserializeLayout(elem);
                        // Restore hidden dock container size so it can be used when bar is shown
                        if (!instance.Bar.IsVisible)
                        {
                            if (instance.LayoutBounds.Height > 0 && (instance.Bar.DockSide == eDockSide.Top || instance.Bar.DockSide == eDockSide.Bottom))
                            {
                                instance.Bar.Height = instance.LayoutBounds.Height;
                            }
                            else if (instance.LayoutBounds.Width > 0 && (instance.Bar.DockSide == eDockSide.Left || instance.Bar.DockSide == eDockSide.Right))
                            {
                                instance.Bar.Width = instance.LayoutBounds.Width;
                            }
                        }
                    }
                    else
                        return false;
					break;
				}
			}

			return true;
		}
コード例 #28
0
		protected internal override void Serialize(ItemSerializationContext context)
		{
			base.Serialize(context);
            System.Xml.XmlElement ThisItem = context.ItemXmlElement;
			ThisItem.SetAttribute("Caption",_Caption);
			ThisItem.SetAttribute("TextBoxWidth",System.Xml.XmlConvert.ToString(m_TextBoxWidth));
			ThisItem.SetAttribute("AlwaysShowCaption",System.Xml.XmlConvert.ToString(m_AlwaysShowCaption));

			ThisItem.SetAttribute("MenuVisibility",System.Xml.XmlConvert.ToString((int)m_MenuVisibility));
			ThisItem.SetAttribute("RecentlyUsed",System.Xml.XmlConvert.ToString(m_RecentlyUsed));
		}
コード例 #29
0
		public virtual void Deserialize(ItemSerializationContext context)
		{
            System.Xml.XmlElement ItemXmlSource = context.ItemXmlElement;

			m_Name=ItemXmlSource.GetAttribute("name");
            if (ItemXmlSource.HasAttribute("globalname"))
                m_GlobalName = ItemXmlSource.GetAttribute("globalname");
			m_Text=ItemXmlSource.GetAttribute("text");
			m_AccessKey=NativeFunctions.GetAccessKey(m_Text);
			m_IsContainer=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("iscontainer"));
            if (context._DesignerHost == null)
                m_Visible = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("visible"));
            else
                TypeDescriptor.GetProperties(this)["Visible"].SetValue(this, System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("visible")));
			if(ItemXmlSource.GetAttribute("itemdata")!="")
				m_ItemData=ItemXmlSource.GetAttribute("itemdata");
			else
				m_ItemData="";
			m_Enabled=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("enabled"));
			m_BeginGroup=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("begingroup"));
			m_Style=(eDotNetBarStyle)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("style"));
			m_Description=ItemXmlSource.GetAttribute("desc");
			m_Tooltip=ItemXmlSource.GetAttribute("tooltip");
			m_Category=ItemXmlSource.GetAttribute("category");
			m_CanCustomize=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("cancustomize"));
			m_ShowSubItems=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("showsubitems"));
			m_ItemAlignment=(eItemAlignment)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("itemalignment"));
			if(ItemXmlSource.HasAttribute("stretch"))
				m_Stretch=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("stretch"));
			else
				m_Stretch=false;
			if(ItemXmlSource.HasAttribute("global"))
				m_GlobalItem=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("global"));

			if(ItemXmlSource.HasAttribute("themes"))
				m_ThemeAware=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("themes"));

			if(ItemXmlSource.HasAttribute("adefdesc"))
				m_AccessibleDefaultActionDescription=ItemXmlSource.GetAttribute("adefdesc");
			if(ItemXmlSource.HasAttribute("adesc"))
				m_AccessibleDescription=ItemXmlSource.GetAttribute("adesc");
			if(ItemXmlSource.HasAttribute("aname"))
				m_AccessibleName=ItemXmlSource.GetAttribute("aname");
			if(ItemXmlSource.HasAttribute("arole"))
				m_AccessibleRole=(System.Windows.Forms.AccessibleRole)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("arole"));
			if(ItemXmlSource.HasAttribute("autocollapse"))
				m_AutoCollapseOnClick=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("autocollapse"));
			else
                m_AutoCollapseOnClick=true;
			
			if(ItemXmlSource.HasAttribute("autorepeat"))
				m_ClickAutoRepeat=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("autorepeat"));
			else
				m_ClickAutoRepeat=false;
			if(ItemXmlSource.HasAttribute("clickrepinterv"))
				m_ClickRepeatInterval=System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("clickrepinterv"));
			else
				m_ClickRepeatInterval=600;

            //if (ItemXmlSource.HasAttribute("GenerateCommandLink"))
            //    m_GenerateCommandLink = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("GenerateCommandLink"));
            //else
            //    m_GenerateCommandLink = false;
			
			// Load Cursor
			if(ItemXmlSource.HasAttribute("cur"))
			{
				switch(ItemXmlSource.GetAttribute("cur"))
				{
					case "4":
						m_Cursor=System.Windows.Forms.Cursors.Hand;
						break;
					case "1":
						m_Cursor=System.Windows.Forms.Cursors.AppStarting;
						break;
					case "2":
						m_Cursor=System.Windows.Forms.Cursors.Arrow;
						break;
					case "3":
						m_Cursor=System.Windows.Forms.Cursors.Cross;
						break;
					case "5":
						m_Cursor=System.Windows.Forms.Cursors.Help;
						break;
					case "6":
						m_Cursor=System.Windows.Forms.Cursors.HSplit;
						break;
					case "7":
						m_Cursor=System.Windows.Forms.Cursors.IBeam;
						break;
					case "8":
						m_Cursor=System.Windows.Forms.Cursors.No;
						break;
					case "9":
						m_Cursor=System.Windows.Forms.Cursors.NoMove2D;
						break;
					case "10":
						m_Cursor=System.Windows.Forms.Cursors.NoMoveHoriz;
						break;
					case "11":
						m_Cursor=System.Windows.Forms.Cursors.NoMoveVert;
						break;
					case "12":
						m_Cursor=System.Windows.Forms.Cursors.PanEast;
						break;
					case "13":
						m_Cursor=System.Windows.Forms.Cursors.PanNE;
						break;
					case "14":
						m_Cursor=System.Windows.Forms.Cursors.PanNorth;
						break;
					case "15":
						m_Cursor=System.Windows.Forms.Cursors.PanNW;
						break;
					case "16":
						m_Cursor=System.Windows.Forms.Cursors.PanSE;
						break;
					case "17":
						m_Cursor=System.Windows.Forms.Cursors.PanSouth;
						break;
					case "18":
						m_Cursor=System.Windows.Forms.Cursors.PanSW;
						break;
					case "19":
						m_Cursor=System.Windows.Forms.Cursors.PanWest;
						break;
					case "20":
						m_Cursor=System.Windows.Forms.Cursors.SizeAll;
						break;
					case "21":
						m_Cursor=System.Windows.Forms.Cursors.SizeNESW;
						break;
					case "22":
						m_Cursor=System.Windows.Forms.Cursors.SizeNS;
						break;
					case "23":
						m_Cursor=System.Windows.Forms.Cursors.SizeNWSE;
						break;
					case "24":
						m_Cursor=System.Windows.Forms.Cursors.SizeWE;
						break;
					case "25":
						m_Cursor=System.Windows.Forms.Cursors.UpArrow;
						break;
					case "26":
						m_Cursor=System.Windows.Forms.Cursors.VSplit;
						break;
					case "27":
						m_Cursor=System.Windows.Forms.Cursors.WaitCursor;
						break;
				}
			}

			System.Xml.XmlNodeList list=ItemXmlSource.GetElementsByTagName("subitems");
			if(list.Count>0)
			{
				foreach(System.Xml.XmlElement xmlChild in list[0].ChildNodes)
				{
//					BaseItem oi=null;
//					System.Reflection.Assembly a=System.Reflection.Assembly.Load(xmlChild.GetAttribute("assembly"));
//					if(a==null) continue;
//					oi=a.CreateInstance(xmlChild.GetAttribute("class")) as BaseItem;
					BaseItem oi=context.CreateItemFromXml(xmlChild);
					if(oi!=null)
					{
						this.SubItems.Add(oi);
                        context.ItemXmlElement = xmlChild;
						oi.Deserialize(context);
                        context.ItemXmlElement = ItemXmlSource;
					}
				}
			}
			if(ItemXmlSource.HasAttribute("shortcuts"))
			{
				if(m_Shortcuts==null)
					m_Shortcuts=new ShortcutsCollection(this);
				m_Shortcuts.FromString(ItemXmlSource.GetAttribute("shortcuts"),",");
			}

            if (context.HasDeserializeItemHandlers)
            {
                System.Xml.XmlNodeList customDataList=ItemXmlSource.GetElementsByTagName("customData");
                if (customDataList.Count > 0)
                {
                    System.Xml.XmlElement customData = customDataList[0] as System.Xml.XmlElement;
                    SerializeItemEventArgs e = new SerializeItemEventArgs(this, ItemXmlSource, customData);
                    context.Serializer.InvokeDeserializeItem(e);
                }
            }

            MarkupTextChanged();
        }
コード例 #30
0
ファイル: ColorItem.cs プロジェクト: huamanhtuyen/VNACCS
        // <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 xml = context.ItemXmlElement;
            ElementSerializer.Deserialize(this, xml);
        }