public void Update(Graphics g, string text, Font font, Padding internalBounds,
Rectangle bounds, Color color, TextFormatFlags formatFlags, IThemeTextOption[] options) {
IntPtr compatHdc = this._TextHDC;
if (bounds.Equals(_TextHDCBounds)) {
//Same bounds, reuse HDC and Clear it
IntPtr hClearBrush = Native.GDI.CreateSolidBrush(ColorTranslator.ToWin32(Color.Black));
Native.RECT cleanRect = new Native.RECT(bounds);
Native.GDI.FillRect(compatHdc, ref cleanRect, hClearBrush);
Native.GDI.DeleteObject(hClearBrush);
}
else {
//Other bounds, create new HDC
IntPtr outputHdc = g.GetHdc();
IntPtr DIB;
compatHdc = CreateNewHDC(outputHdc, bounds, out DIB);
//Store new data
_TextHDC = compatHdc;
_TextHDCBounds = bounds;
//Clear up
CleanUpHDC(DIB);
g.ReleaseHdc(outputHdc);
}
DrawOnHDC(compatHdc, text, font, internalBounds, bounds, color, formatFlags, options);
}