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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:07:39+00:00 2026-05-15T12:07:39+00:00

I have created a user control on winform where i want to display some

  • 0

I have created a user control on winform where i want to display some text on Label Control at runtime.
Here I used textFormatFlag as WordBreak and then displays it in the next line. Size of label is fixed in width while variable in height. Now the problem here is how to break a string if there is no space between i.e. no WordBreak Present in the string.
I dont want to do calculations on font size and accordingly modify string. Is it something hidden in .net that can do this work for me.

    sizeCategory = TextRenderer.MeasureText(Source["Parent_Name"].ToString()
                  , lbldbCategory.Font
                  , sizeCategory
                  , TextFormatFlags.WordBreak);

Consider lines as a boundary of my label. width height. Height being variable.
Consider this eg.

My text string being

"salkdjasldjkslakdjlsakjdlsakjdkajhk sdjahksajd" //see word break between the string
-----------------------------------------------|
salkdjasldjkslakdjlsakjdlsakjdkajhk            |
sdjahksajd                                     |
-----------------------------------------------|

What I did and currently getting is this.

due to word break

-----------------------------------------------|
salkdjasldjkslakdjlsakjdlsakjd                 |
kajhksdjahksajdh                               | 
-----------------------------------------------|

What is happening is when string has no space i.e. no word break

-----------------------------------------------|
salkdjasldjkslakdjlsakjdlsakjdkajhksdjahksajdhasdasdasdsadasd|
-----------------------------------------------|

What I want is

-----------------------------------------------|
salkdjasldjkslakdjlsakjdlsakjdkajhksdjahksajdha|
sdasdasdsadasd                                 |
-----------------------------------------------|
  • 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-05-15T12:07:39+00:00Added an answer on May 15, 2026 at 12:07 pm

    Since you are using a label control, leave AutoSize set to true, and set the MaximumSize property to something like 150, 0.

    Just tested it. It works.

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

Sidebar

Related Questions

I have created a user control (CheckedDirTree) that exposes a CheckedFolder property which in
I have created an Address user control which is as follow: <%@ Control Language=C#
I have created a COM enabled .NET User Control and am wondering what is
I have a user control that I've created, however when I go to add
I have created a WinForms user control that is a set of five cascading
I have created a user control that contains a button. I am using this
I have a WinForms control on which I want to display two things: An
I have created a User Control in my application that has a textbox and
I have created a user control in Silverlight which basically animates the size of
I have created a user control in silver-light. I will use this control in

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.