public static AeroText Create(Graphics g, string text, Font font, Padding internalBounds, Rectangle bounds, Color color, TextFormatFlags formatFlags, AeroLabelMode mode, IThemeTextOption[] options) { IntPtr outputHdc = g.GetHdc(); IntPtr DIB; IntPtr compatHdc = AeroText.CreateNewHDC(outputHdc, bounds, out DIB); AeroText.DrawOnHDC(compatHdc, text, font, internalBounds, bounds, color, formatFlags, mode, options); AeroText.CleanUpHDC(DIB); g.ReleaseHdc(outputHdc); return(new AeroText(compatHdc, bounds, mode)); }
public void Update(Graphics g, string text, Font font, Padding internalBounds, Rectangle bounds, Color color, Color backColor, TextFormatFlags formatFlags, IThemeTextOption[] options) { IntPtr compatHdc = this._TextHDC; if (bounds.Equals(this._TextHDCBounds)) { IntPtr hClearBrush = NativeMethod.CreateSolidBrush(ColorTranslator.ToWin32(backColor)); RECT cleanRect = new RECT(bounds); NativeMethod.FillRect(compatHdc, ref cleanRect, hClearBrush); NativeMethod.DeleteObject(hClearBrush); } else { IntPtr outputHdc = g.GetHdc(); IntPtr DIB; compatHdc = AeroText.CreateNewHDC(outputHdc, bounds, out DIB); this._TextHDC = compatHdc; this._TextHDCBounds = bounds; AeroText.CleanUpHDC(DIB); g.ReleaseHdc(outputHdc); } AeroText.DrawOnHDC(compatHdc, text, font, internalBounds, bounds, color, formatFlags, this._mode, options); }