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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:47:16+00:00 2026-06-11T15:47:16+00:00

I have a couple of TextBlock s in a Fixed Size Column Grid .

  • 0

I have a couple of TextBlocks in a Fixed Size Column Grid. i.e. The Grid size might change, but its column widths are all the same (e.g. 10% of the whole size) and each column contains a TextBlock.

The font size of all the TextBlocks MUST be the same.

How can I find the maximum possible font size which makes all the texts inside TextBlocks visible?

  • 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-11T15:47:17+00:00Added an answer on June 11, 2026 at 3:47 pm

    You could use Graphics.MeasureString Method (String, Font, Int32) to calculate the fontsize.
    Then use some behaviour magic to bind the font size to the TextBlock.

    private void MeasureStringWidth(PaintEventArgs e)
    {
    
        // Set up string. 
        string measureString = "Measure String";
        Font stringFont = new Font("Arial", 16);
    
        // Set maximum width of string. 
        int stringWidth = 200;
    
        // Measure string.
        SizeF stringSize = new SizeF();
        stringSize = e.Graphics.MeasureString(measureString, stringFont, stringWidth);
    
        // Draw rectangle representing size of string.
        e.Graphics.DrawRectangle(new Pen(Color.Red, 1), 0.0F, 0.0F, stringSize.Width, stringSize.Height);
    
        // Draw string to screen.
        e.Graphics.DrawString(measureString, stringFont, Brushes.Black, new PointF(0, 0));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have couple of servlets designed to hold its own message source, but there
We have couple different web-apps that share the same db link. The hibernate layer
Here's the problem: I have couple of pages which gets its content from a
I have a couple of TextBlocks, bound to different things. Both TextBlocks have the
I have couple of input fields with the class link. All of them should
I have a ComboBox, and i want to change its look when the ItemsSource
I have couple of asp.net link buttons, can't change them to asp.net hyperlinks. I
I have a TextBlock and a couple Buttons in a StatusBar. The Buttons are
I have couple of charts working but whenever the chart spline is on 1-3
I have couple of questions regarding boost licensing, Is it that all the boost

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.