Question How do I set label to be exactly 4 inches in length? + Need help with project.

MaresFillies

New member
Joined
Apr 20, 2016
Messages
1
Programming Experience
Beginner
Hi everyone, I'm new the forums and new to visual studios. :welcoming:

The question I posed in the title is actually one small part to a bigger specifications list I need to do for a project. So here is the project. I just need a push in the right direction.

Okay so here is what I need to do, I need to create a simple windows form application that does the following:
It has to read strings from a file just one word on each line followed by a newline so my data input is something like this inside a "input.txt" file:

hello
welcome
world
purple
pony
microsoft

Those word are then displayed one at a time into two labels that must have the following specifications such that they labels always fit each word no matter what the length:

I figured out how to do all the above, but as far as specifications go for the labels I'm stuck.

I need to have 2 labels in my windows form.

The first label should always display text in 16 point font and it's width property needs to be automatically adjusted to fit the words from the input.txt file with label margins left and right set to approximately 2 character widths.

The second label should have a fixed horizontal width of exactly 4 inches, but the font size of the control should change automatically for each new word that is displayed by it so basically it must adjust on the fly to accommodate the word size length between let's say the word "pony" and "microsoft".
The entire word should be visible in that length of 4 inch label and the margins again on either side of the label with the word centered should be 2 character widths in length.
 
Back
Top