private void OnLoad(string skinConfigFile) { try { SkinConfig skin = XmlHelper.ReadConfig <SkinConfig>(skinConfigFile); _formBorder = new ControlPaintHelper(PaintHelperData.Read(skin.Border, skin, "FormBorder")); _formCaption = new ControlPaintHelper(PaintHelperData.Read(skin.Caption.Backgroud, skin, "FormCaption")); Size imageSize = PaintHelperData.StringToSize(skin.Caption.NormalButton.IconSize); _formCloseIcon = new ImageStrip(true, imageSize, new Bitmap(skin.Images["CloseIcon"])); _formRestoreIcon = new ImageStrip(true, imageSize, new Bitmap(skin.Images["RestoreIcon"])); _formMaximizeIcon = new ImageStrip(true, imageSize, new Bitmap(skin.Images["MaximizeIcon"])); _formMinimizeIcon = new ImageStrip(true, imageSize, new Bitmap(skin.Images["MinimizeIcon"])); _formCaptionButton = new ControlPaintHelper(PaintHelperData.Read(skin.Caption.NormalButton, skin, "FormCaptionButton")); imageSize = PaintHelperData.StringToSize(skin.Caption.SmallButton.IconSize); _formCloseIconSmall = new ImageStrip(true, imageSize, new Bitmap(skin.Images["CloseIconSmall"])); _formRestoreIconSmall = new ImageStrip(true, imageSize, new Bitmap(skin.Images["RestoreIconSmall"])); _formMaximizeIconSmall = new ImageStrip(true, imageSize, new Bitmap(skin.Images["MaximizeIconSmall"])); _formMinimizeIconSmall = new ImageStrip(true, imageSize, new Bitmap(skin.Images["MinimizeIconSmall"])); _formCaptionButtonSmall = new ControlPaintHelper(PaintHelperData.Read(skin.Caption.SmallButton, skin, "FormCaptionButton")); _formActiveTitleColor = PaintHelperData.StringToColor(skin.ActiveCaption); _formInactiveTitleColor = PaintHelperData.StringToColor(skin.InactiveCation); _formIsTextCentered = skin.CenterCaption; } catch (System.Exception ex) { throw new ApplicationException("Invalid SkinConfig XML", ex); } _cornerSize = new Size(9, 9); }
//jxz public static PaintHelperData Read(ISkinConfig skinConfig, SkinConfig skin, string imageName) { PaintHelperData data = new PaintHelperData(); data.Image = new Bitmap(skin.Images[imageName]); data.ImageSize = StringToSize(skinConfig.ImageSize); data.ImagePadding = StringToPadding(skinConfig.ImagePadding); return(data); }