private static DrawTextFormat MapTextFormat(TextFormat format) { var drawTextFormat = DrawTextFormat.Top; if (format.HasFlag(TextFormat.Bottom)) { drawTextFormat ^= DrawTextFormat.Bottom; } if (format.HasFlag(TextFormat.Center)) { drawTextFormat ^= DrawTextFormat.Center; } if (format.HasFlag(TextFormat.Left)) { drawTextFormat ^= DrawTextFormat.Left; } if (format.HasFlag(TextFormat.Right)) { drawTextFormat ^= DrawTextFormat.Right; } if (format.HasFlag(TextFormat.SingleLine)) { drawTextFormat ^= DrawTextFormat.SingleLine; } if (format.HasFlag(TextFormat.Top)) { drawTextFormat ^= DrawTextFormat.Top; } if (format.HasFlag(TextFormat.WordBreak)) { drawTextFormat ^= DrawTextFormat.WordBreak; } if (format.HasFlag(TextFormat.VerticalCenter)) { drawTextFormat ^= DrawTextFormat.VerticalCenter; } return drawTextFormat; }