I am looking to shorten the text inside a label if its width exceeds the total width of its container. Instead of displaying the full text, I want to display a sub-string of it.
if (SensorType.Text.Length >= 25) {
SensorType.Text = SensorType.Text.Substring(0, 20) + "...";
}
While this code works, it does not take into consideration specific dimensions or areas of a .div element. Is there a way to detect the pixels of a div?