protected virtual void RenderImages(ImageManager imgManager) { if (TextSettings.DrawBox) { ImageRenderer render = new ImageRenderer(imgManager.GetImageObject(TextSettings.DefaultImage, DeckType)); render.DrawBox(ColorTranslator.FromHtml(TextSettings.BoxColor), ModelDisplayText.GetNumValue(TextSettings.BoxSize, 2), TextSettings.GetRectangleBox()); DefaultImageRender = render.RenderImage64(); render.Dispose(); render = new ImageRenderer(imgManager.GetImageObject(TextSettings.ErrorImage, DeckType)); render.DrawBox(ColorTranslator.FromHtml("#d70000"), ModelDisplayText.GetNumValue(TextSettings.BoxSize, 2), TextSettings.GetRectangleBox()); ErrorImageRender = render.RenderImage64(); render.Dispose(); } }
protected override void Redraw(ImageManager imgManager) { if (!ValueManager.IsChanged(ID.ControlState) && !ForceUpdate) { return; } string value = ValueManager[ID.ControlState]; if (Settings.DecodeBCD) { value = ModelDisplay.ConvertFromBCD(value); } value = TextSettings.ScaleValue(value); value = TextSettings.RoundValue(value); //evaluate value and set indication string background = DefaultImage; TextSettings.GetFontParameters(TitleParameters, out Font drawFont, out Color drawColor); Color boxColor = ColorTranslator.FromHtml(TextSettings.BoxColor); string text = ""; if (TextSettings.HasIndication && TextSettings.IndicationValue == value) { background = TextSettings.IndicationImage; if (!TextSettings.IndicationHideValue) { text = TextSettings.FormatValue(value); if (TextSettings.IndicationUseColor) { drawColor = ColorTranslator.FromHtml(TextSettings.IndicationColor); } } if (TextSettings.IndicationUseColor) { boxColor = ColorTranslator.FromHtml(TextSettings.IndicationColor); } } else { text = TextSettings.FormatValue(value); } text = TextSettings.GetValueMapped(text); if (text != lastText || ForceUpdate) { ImageRenderer render = new ImageRenderer(imgManager.GetImageObject(background, DeckType)); if (TextSettings.DrawBox) { render.DrawBox(boxColor, ModelDisplayText.GetNumValue(TextSettings.BoxSize, 2), TextSettings.GetRectangleBox()); } if (text != "") { render.DrawText(text, drawFont, drawColor, TextSettings.GetRectangleText()); } DrawImage = render.RenderImage64(); IsRawImage = true; NeedRedraw = true; lastText = text; render.Dispose(); } }