/// <summary> /// Initializes a new instance of the <see cref="ControlPaintHelper"/> class. /// </summary> /// <param name="data">The data container for this ControlPaintHelper.</param> public ControlPaintHelper(PaintHelperData data) { _data = data; Images = new ImageStrip { Image = _data.Image, ImageSize = _data.ImageSize }; if (!_data.ContentBounds.IsEmpty) return; Rectangle rect = new Rectangle(Point.Empty, _data.ImageSize); rect.X += _data.ImagePadding.Left; rect.Y += _data.ImagePadding.Top; rect.Width -= _data.ImagePadding.Horizontal; rect.Height -= _data.ImagePadding.Vertical; _data.ContentBounds = rect; }
/// <summary> /// Called when the skin is loaded. /// </summary> public override void OnLoad() { try { LoadResourceManager(); XmlDocument skinDef = new XmlDocument(); skinDef.LoadXml(_currentManager.GetString("SkinDefinition")); XmlElement elm = skinDef.DocumentElement; XmlNode form = elm["Form"]; XmlNode captionNode = form["Caption"]; XmlNode normalButton = captionNode["NormalButton"]; XmlNode smallButton = captionNode["SmallButton"]; // Background _formBorder = new ControlPaintHelper(PaintHelperData.Read(form["Border"], _currentManager, "FormBorder")); _formCaption = new ControlPaintHelper(PaintHelperData.Read(captionNode["Background"], _currentManager, "FormCaption")); // Big Buttons Size imageSize = PaintHelperData.StringToSize(normalButton["IconSize"].InnerText); _formCloseIcon = new ImageStrip(true, imageSize, (Bitmap)_currentManager.GetObject("CloseIcon")); _formRestoreIcon = new ImageStrip(true, imageSize, (Bitmap)_currentManager.GetObject("RestoreIcon")); _formMaximizeIcon = new ImageStrip(true, imageSize, (Bitmap)_currentManager.GetObject("MaximizeIcon")); _formMinimizeIcon = new ImageStrip(true, imageSize, (Bitmap)_currentManager.GetObject("MinimizeIcon")); _formCaptionButton = new ControlPaintHelper(PaintHelperData.Read(normalButton, _currentManager, "FormCaptionButton")); // Small Buttons imageSize = PaintHelperData.StringToSize(smallButton["IconSize"].InnerText); _formCloseIconSmall = new ImageStrip(true, imageSize, (Bitmap)_currentManager.GetObject("CloseIconSmall")); _formRestoreIconSmall = new ImageStrip(true, imageSize, (Bitmap)_currentManager.GetObject("RestoreIconSmall")); _formMaximizeIconSmall = new ImageStrip(true, imageSize, (Bitmap)_currentManager.GetObject("MaximizeIconSmall")); _formMinimizeIconSmall = new ImageStrip(true, imageSize, (Bitmap)_currentManager.GetObject("MinimizeIconSmall")); _formCaptionButtonSmall = new ControlPaintHelper(PaintHelperData.Read(smallButton, _currentManager, "FormCaptionButton")); // General Infos _formActiveTitleColor = PaintHelperData.StringToColor(form["ActiveCaption"].InnerText); _formInactiveTitleColor = PaintHelperData.StringToColor(form["InactiveCaption"].InnerText); _formIsTextCentered = PaintHelperData.StringToBool(form["CenterCaption"].InnerText); } catch (Exception e) { throw new ApplicationException("Invalid SkinDefinition XML", e); } }
/// <summary> /// Initializes a new instance of the <see cref="ControlPaintHelper"/> class. /// </summary> /// <param name="data">The data container for this ControlPaintHelper.</param> public ControlPaintHelper(PaintHelperData data) { _data = data; Images = new ImageStrip { Image = _data.Image, ImageSize = _data.ImageSize }; if (!_data.ContentBounds.IsEmpty) { return; } Rectangle rect = new Rectangle(Point.Empty, _data.ImageSize); rect.X += _data.ImagePadding.Left; rect.Y += _data.ImagePadding.Top; rect.Width -= _data.ImagePadding.Horizontal; rect.Height -= _data.ImagePadding.Vertical; _data.ContentBounds = rect; }