public static SizeF DrawStringWithOutline(this Graphics g, string text, Font font, float x, float y, Color outlineColor, Color fillColor, float outlineWidth = 1)
{
+ if (text == null) return SizeF.Empty;
+
// assuming g is the Graphics object on which you want to draw the text