private void AddDefaultTextDrawPackProperties(ThemePropertyContainer container) { container.EnsureColorValue(TMT.TEXTCOLOR, Color.FromArgb(0)); if (container.HasProperty(TMT.TEXTSHADOWOFFSET)) { container.EnsureColorValue(TMT.TEXTSHADOWCOLOR, Color.FromArgb(0)); container.EnsureEnumValue(TMT.TEXTSHADOWTYPE, TEXTSHADOWTYPE.TST_NONE); } if (!container.HasProperty(TMT.TEXTBORDERSIZE)) { container.EnsureIntValue(TMT.TEXTBORDERSIZE, 0); } else { container.EnsureColorValue(TMT.TEXTBORDERCOLOR, Color.FromArgb(0)); container.EnsureBoolValue(TMT.TEXTAPPLYOVERLAY, false); } container.EnsureIntValue(TMT.TEXTGLOWSIZE, 0); container.EnsureIntValue(TMT.GLOWINTENSITY, 0); container.EnsureColorValue(TMT.GLOWCOLOR, Color.FromArgb(0xFFFFFF)); container.EnsureBoolValue(TMT.TEXTITALIC, false); var edgeLight = container.EnsureColorValue(TMT.EDGELIGHTCOLOR, Color.FromArgb(0xC0C0C0)); container.EnsureColorValue(TMT.EDGEHIGHLIGHTCOLOR, Color.FromArgb(0xFFFFFF)); container.EnsureColorValue(TMT.EDGESHADOWCOLOR, Color.FromArgb(0x808080)); container.EnsureColorValue(TMT.EDGEDKSHADOWCOLOR, Color.FromArgb(0)); container.EnsureColorValue(TMT.EDGEFILLCOLOR, edgeLight); container.EnsureBoolValue(TMT.COMPOSITED, false); }
private void AddDefaultProperties(ThemePropertyContainer container) { BGTYPE bgType = container.EnsurePropertyValue(TMT.BGTYPE, TMT.ENUM, BGTYPE.BT_BORDERFILL); if (bgType == BGTYPE.BT_BORDERFILL) { AddDefaultBorderFillProperties(container); } else if (bgType == BGTYPE.BT_IMAGEFILE) { AddDefaultImageFileProperties(container); } AddDefaultTextDrawPackProperties(container); }
private void AddDefaultImageFileProperties(ThemePropertyContainer container) { container.EnsureIntValue(TMT.IMAGECOUNT, 1); container.EnsureEnumValue(TMT.IMAGELAYOUT, IMAGELAYOUT.IL_HORIZONTAL); container.EnsureEnumValue(TMT.TRUESIZESCALINGTYPE, TRUESIZESCALINGTYPE.TSST_NONE); container.EnsureEnumValue(TMT.SIZINGTYPE, SIZINGTYPE.ST_STRETCH); container.EnsureEnumValue(TMT.TRUESIZESCALINGTYPE, TRUESIZESCALINGTYPE.TSST_NONE); container.EnsureBoolValue(TMT.BORDERONLY, false); container.EnsureIntValue(TMT.TRUESIZESTRETCHMARK, 0); container.EnsureBoolValue(TMT.UNIFORMSIZING, false); container.EnsureBoolValue(TMT.INTEGRALSIZING, false); container.EnsureBoolValue(TMT.MIRRORIMAGE, true); container.EnsureEnumValue(TMT.HALIGN, HALIGN.HA_CENTER); container.EnsureEnumValue(TMT.VALIGN, VALIGN.VA_CENTER); if (container.HasProperty(TMT.BGFILL)) { container.EnsureColorValue(TMT.FILLCOLOR, Color.FromArgb(0xFFFFFF)); } var sizingMargins = container.EnsureMarginsValue(TMT.SIZINGMARGINS, new MARGINS()); container.EnsureMarginsValue(TMT.CONTENTMARGINS, sizingMargins); container.EnsureBoolValue(TMT.SOURCEGROW, false); container.EnsureBoolValue(TMT.SOURCESHRINK, false); var glyphType = container.EnsureEnumValue(TMT.GLYPHTYPE, GLYPHTYPE.GT_NONE); if (glyphType == GLYPHTYPE.GT_FONTGLYPH) { container.EnsureColorValue(TMT.GLYPHTEXTCOLOR, Color.FromArgb(0)); container.EnsureIntValue(TMT.GLYPHINDEX, 1); } if (glyphType != 0) { container.EnsureBoolValue(TMT.GLYPHONLY, false); } container.EnsureEnumValue(TMT.IMAGESELECTTYPE, IMAGESELECTTYPE.IST_NONE); }
private void AddDefaultBorderFillProperties(ThemePropertyContainer container) { var borderType = container.EnsureEnumValue(TMT.BORDERTYPE, BORDERTYPE.BT_RECT); container.EnsureColorValue(TMT.BORDERCOLOR, Color.FromArgb(0)); var borderSize = container.EnsureIntValue(TMT.BORDERSIZE, 1); if (borderType == BORDERTYPE.BT_ROUNDRECT) { container.EnsureIntValue(TMT.ROUNDCORNERWIDTH, 80); container.EnsureIntValue(TMT.ROUNDCORNERHEIGHT, 80); } var fillType = container.EnsureEnumValue(TMT.FILLTYPE, FILLTYPE.FT_SOLID); switch (fillType) { case FILLTYPE.FT_SOLID: container.EnsureColorValue(TMT.FILLCOLOR, Color.FromArgb(0xFFFFFF)); break; case FILLTYPE.FT_HORZGRADIENT: case FILLTYPE.FT_VERTGRADIENT: case FILLTYPE.FT_RADIALGRADIENT: for (var prop = TMT.GRADIENTRATIO1; prop < TMT.GRADIENTRATIO5; ++prop) { if (container.HasProperty(prop + 1404)) { container.EnsureIntValue(prop, 0); } } break; } container.EnsureMarginsValue(TMT.CONTENTMARGINS, new MARGINS { cxLeftWidth = borderSize, cxRightWidth = borderSize, cyTopHeight = borderSize, cyBottomHeight = borderSize }); }