protected override void OnPostRender(DrawingContext dc) { base.OnPostRender(dc); if (gm.IsTrial) dc.DrawText("Demo version", font, Color.Red, 0, 0); }
public override void OnRender(DrawingContext dc) { if (font != null && !Utils.StringIsNullOrEmpty(text)) dc.DrawText(text, font, foreColor, 0, 0); }
protected override void OnRender(DrawingContext dc) { if (background != null) dc.DrawRectangle(background, null, 0, 0, Width, Height); if (font != null && !Utils.StringIsNullOrEmpty(text)) { string s = text; // this is important to take a copy!!! don't change!!! dc.DrawText(ref s, font, foreColor, 0, textOffsetY, Width, wordWrap ? Height : font.Height, alignment, trimming, wordWrap); } }
protected override void OnRender(DrawingContext dc) { #region Background int b = border != null ? 1 : 0; dc.DrawRectangle(TouchCapture.Captured == this ? backgroundPressed : backgroundUnpressed, null, b, b, Width - 2 * b, Height - 2 * b); #endregion bool hasForeground = foreground != null; bool hasText = font != null && !Utils.StringIsNullOrEmpty(text); if (hasForeground && !hasText) { // image only ushort originalOpacity = foreground.Opacity; if (!IsEnabled) foreground.Opacity = (ushort)(originalOpacity / 2); int a = (Width < Height ? Width : Height) - 2; dc.DrawRectangle(foreground, null, (Width - a) / 2, (Height - a) / 2, a, a); foreground.Opacity = originalOpacity; } else if (!hasForeground && hasText) { // text only int w = 0, h = 0; font.ComputeExtent(text, out w, out h); string s = text; dc.DrawText(ref s, font, foreColor, 0, (Height - h) / 2, Width, h, TextAlignment.Center, TextTrimming.None, false); } else if (hasForeground && hasText) { if (textBelow) { } else { } } #region Border //if (border != null) //{ // int corner = 3; // dc.DrawFrame(border, 0, 0, Width, Height, corner, corner); //} #endregion }