Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9266749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:23:25+00:00 2026-06-18T14:23:25+00:00

It it somehow possible to draw a string using the GDI onto an image

  • 0

It it somehow possible to draw a string using the GDI onto an image using a StringBuilder instead of a string? There is no Graphics.DrawString() overload that accepts a StringBuilder. But a regular string can in some cases dramatically increase the GC time (in my case 52% according to the CLR Profiler).

Note: I DON’T want to use the XNA Framework which supports StringBuilders as of 4.0.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:23:26+00:00Added an answer on June 18, 2026 at 2:23 pm

    I don’t believe it is possible without using some alternative graphics library.

    Since .NET 4.0, StringBuilder does not use a String class internally (even with reflection you cannot extract a String object).

    You are right that calling myStringBuilder.ToString() will incur a performance hit; it is essentially making a copy of your string each time it is called. But in code that calls Graphics.DrawString(), I just don’t see that being a bottleneck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is is somehow possible to control letter spacing when using Graphics.DrawString? I cannot find
Is it possible to animate something that you have drawn using core graphics in
On an apache server using the worker MPM, is it somehow possible to open
Is it possible somehow to ask the user to allow cross-domain access instead of
Is this possible somehow to generate a GUID in C#, that mostly corresponds to
Is it somehow possible to get glBitmap() to draw a GL_RGBA bitmap? glBitmap() is
Backstory: I'm trying to draw as many squares the the screen as possible using
Is that somehow possible to access one datastore? Or access one app from different
That's how I draw two graphics (thanks for guys who helped me to do
Is it somehow possible to annotate a Java Method in that way that i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.