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 7925625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:22:35+00:00 2026-06-03T18:22:35+00:00

My program draws a multi-line text into a box in a PrintDocument using the

  • 0

My program draws a multi-line text into a box in a PrintDocument using the PrintPage event. The width is set but the height should grow depending on the size of the text.

int BoxHeight = (int)e.Graphics.MeasureString(StringToDraw, FontToUse, BoxWidth).Height;

This returns mostly double the height that im looking for most of the time, but not always. The e object is the System.Drawing.Printing.PrintPageEventArgs handed to the PrintDocument.PrintPage-event. I want the box to fit the text tightly, wasting no dead trees for printing white empty spaces.

I’ve searched for solutions but maybe theres something I didn’t understand because I couldn’t make them work for me.

  • 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-03T18:22:37+00:00Added an answer on June 3, 2026 at 6:22 pm

    Found the problem. I had set the BoxWidth as half of what it was supposed to be. Works great now.

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

Sidebar

Related Questions

My program draws text strings into rectangles by working out the width and height
My program draws text on its panel,but if I'd like to remove the text
I have a program that draws some vector graphics using System.Drawing and the Graphics
I'm a java beginner, & I'm creating a program that draws lines using the
I have an android program which draws lines and text to a canvas. (These
I'm writing an OpenGL program that draws into an Auxiliary Buffer, then the content
My program draws heavily on a winform. During the drawing, the winform is not
I am trying to add some shaders to my old OpenGL program that draws
I have a program where I want to draw a line between two points.
I've been thinking about a program logic, but I cannot draw a conclusion to

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.