Question

LabelControl in my form takes its Text property value dynamically.Text Value being long,half of the text gets overlapped by other controls or due to restriction in parent control size.I tried

AutoSize property

,but it autosizes only in one fixed direction,either vertical or horizontal.I have also tried

SetPreferedSize(New Size(50,50))

,but that is not working for me,can anybody show me a way how can I re-size my label-control to occupy a fixed rectangular size portion?

Was it helpful?

Solution

You need to set following properties of Control:

WordWrap = Wrap

AutoSizeMode= None

VAlignment = Top

Width = 100

Height = 100

Or you can refer example link below:

Devexpress Example

OTHER TIPS

You can specify a maximum width/height for a auto-sized label:

Maximum width of 40px:

Me.Label1.MaximumSize = New Size(40, 0)

Maximum height of 40px:

Me.Label1.MaximumSize = New Size(0, 40)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top