/// <summary> /// Load all hotspots for the skin /// </summary> /// <param name="xmlNode"></param> /// <returns></returns> internal ArrayList LoadControls(XmlNode xmlNode) { ArrayList mControls = new ArrayList(); foreach (XmlNode node in xmlNode.ChildNodes) { if (node.Name == @"#comment") { continue; } SkinBaseControl skinControl = (SkinBaseControl)LoadElement(node); if (skinControl == null) { continue; } if (node.ChildNodes.Count != 0) { FormSkin skin = new FormSkin(); skin.ResDir = ResDir; foreach (XmlNode cnode in node.ChildNodes) { if (cnode.Name == "window" && skin.Load(cnode)) { skinControl.Skin = skin; break; } } } else { foreach (XmlAttribute attr in node.Attributes) { if (attr.Name == @"file") { FormSkin skin = new FormSkin(); skin.ResDir = ResDir; try { if (skin.Load(ResDir + @"\", attr.Value)) { skinControl.Skin = skin; break; } } catch (Exception) { break; } } } } mControls.Add(skinControl); } return(mControls); }
/// <summary> /// Loads the style element from document node. /// </summary> /// <param name="objectNode">document node which repersents object</param> /// <returns>instance of class SlideElement</returns> private Object LoadElement(XmlNode styleNode) { string objectType = styleNode.Name; Object retobject = null; if (objectType == "bitmap") { retobject = new SkinBitmap(sResDir); } if (objectType == "element") { retobject = new SkinBaseElement(); ((SkinBaseElement)retobject).BitmapChanged += new BitmapChangedEventHandler(element_BitmapChanged); } else if (objectType == "control") { retobject = new SkinBaseControl(); ((SkinBaseElement)retobject).BitmapChanged += new BitmapChangedEventHandler(element_BitmapChanged); } else if (objectType == "property") { retobject = new SkinElementPropertyInfo(); } /*else if (objectType == "button") * { * retobject = new FlatToggleButton(); * ((SkinBaseElement)retobject).BitmapChanged += new BitmapChangedEventHandler( element_BitmapChanged); * ((FlatToggleButton)retobject).OnNeedUpdate +=new EventHandler(FormSkin_OnNeedUpdate); * ((FlatToggleButton)retobject).OnClick +=new EventHandler(FormSkin_OnClick); * } * else if (objectType == "dragbutton") * { * retobject = new DragFormButton(); * ((DragFormButton)retobject).OnDragBy +=new MouseEventHandler(FormSkin_OnDragBy); * } * else if (objectType == "resizebutton") * { * retobject = new ResizeFormButton(); * ((ResizeFormButton)retobject).OnResizeBy +=new MouseEventHandler(FormSkin_OnResizeBy); * }*/ if (retobject != null) { foreach (XmlAttribute node in styleNode.Attributes) { SetProperty(retobject, node); } } return(retobject); }