Vb.net How to make Fixed width Label

labelvb.netvisual studiowinforms

enter image description here

Like the image above, I want to make a certain Label with fixed width without any scrollbar. It means, actually, the width of Label is changed with the size of outer Panel, however, the height of the Label is just fit to display the whole text inside.

If I set the AutoSize property to True, I can't set the width of the Label.

Thank you!


The important thing is the '…XYZ' part that the HEIGHT of the Label is just fit to the end of the text. No more space or no less space.

I want to make the height of the Label to be just fit to the text inside. The width is changing to fit the width of Form size, which is intended, while the height of the Label is constant, which is NOT.

Best Answer

I did a trick for the solution. (or maybe this is an ordinary solution)

I set the AutoSize property to true then wrapped the Label within a FlowLayoutPanel.

I anchored the Flowable Panel TOP,LEFT and RIGHT as well as set the AutoSize to true.