diff --git a/ShareX.HelpersLib/Helpers/ImageHelpers.cs b/ShareX.HelpersLib/Helpers/ImageHelpers.cs index ab8d457fb..f0c2258fa 100644 --- a/ShareX.HelpersLib/Helpers/ImageHelpers.cs +++ b/ShareX.HelpersLib/Helpers/ImageHelpers.cs @@ -592,15 +592,17 @@ public static void DrawTextWithOutline(Graphics g, string text, PointF position, public static void DrawTextWithShadow(Graphics g, string text, PointF position, Font font, Color textColor, Color shadowColor, int shadowOffset = 1) { + using (Brush textBrush = new SolidBrush(textColor)) using (Brush shadowBrush = new SolidBrush(shadowColor)) { - g.DrawString(text, font, shadowBrush, position.X + shadowOffset, position.Y + shadowOffset); + DrawTextWithShadow(g, text, position, font, textBrush, shadowBrush, shadowOffset); } + } - using (Brush textBrush = new SolidBrush(textColor)) - { - g.DrawString(text, font, textBrush, position.X, position.Y); - } + public static void DrawTextWithShadow(Graphics g, string text, PointF position, Font font, Brush textBrush, Brush shadowBrush, int shadowOffset = 1) + { + g.DrawString(text, font, shadowBrush, position.X + shadowOffset, position.Y + shadowOffset); + g.DrawString(text, font, textBrush, position.X, position.Y); } public static bool IsImagesEqual(Bitmap bmp1, Bitmap bmp2) diff --git a/ShareX.ScreenCaptureLib/Forms/RectangleRegion.cs b/ShareX.ScreenCaptureLib/Forms/RectangleRegion.cs index 2cf83c6ce..e91561a61 100644 --- a/ShareX.ScreenCaptureLib/Forms/RectangleRegion.cs +++ b/ShareX.ScreenCaptureLib/Forms/RectangleRegion.cs @@ -315,7 +315,7 @@ private void DrawAreaText(Graphics g, Rectangle area) g.DrawRectangleProper(textBackgroundPenBlack, backgroundRect.Offset(-1)); g.DrawRectangleProper(textBackgroundPenWhite, backgroundRect); - ImageHelpers.DrawTextWithShadow(g, areaText, textPos, infoFont, Color.White, Color.Black); + ImageHelpers.DrawTextWithShadow(g, areaText, textPos, infoFont, Brushes.White, Brushes.Black); } private void DrawTips(Graphics g, int offset, int padding) @@ -339,7 +339,7 @@ private void DrawTips(Graphics g, int offset, int padding) g.DrawRectangleProper(textBackgroundPenBlack, textRectangle.Offset(-1)); g.DrawRectangleProper(textBackgroundPenWhite, textRectangle); - ImageHelpers.DrawTextWithShadow(g, tipText, textRectangle.Offset(-padding).Location, infoFont, Color.White, Color.Black); + ImageHelpers.DrawTextWithShadow(g, tipText, textRectangle.Offset(-padding).Location, infoFont, Brushes.White, Brushes.Black); } protected virtual void WriteTips(StringBuilder sb)