IntegralHeight Property: Windows Forms

What is IntegralHeight in Windows Forms? And how can you use it to improve your application's user interface? In this article, I investigate IntegralHeight, providing a screenshot demonstration, and then discuss when you might want to use it.

This C# article covers the IntegralHeight property in Windows Forms.

IntegralHeight property

Explanation

In mathematics, an integer is a number that does not contain any fractional part or decimal place. The term "integral" when used as part of IntegralHeight indicates that no fractional part of an entry will be shown. So when IntegralHeight is true, the control will never show a partial item in its list layout. Instead, the size of the control will be contracted such that only complete entries will be shown.

In the screenshot in this article, you can see a demonstration of IntegralHeight on a ListBox control. The size of the ListBox only allows four complete entries, but a fractional part of the fifth. When IntegralHeight is true, then no part of the fifth is shown. When IntegralHeight is false, then the fractional part is shown.

Programming tip

It is best to use IntegralHeight when you have a larger control or the data inside the control is much more important than the surrounding form layout. If the size of the control is important for the visual appeal of the application, then setting IntegralHeight to false might be a good idea. For controls where scrolling is common, then setting IntegralHeight to true would help the visual appearance of the application and make it more usable.

Summary

The IntegralHeight property in Windows Forms provides a useful way to declaratively change the layout of your control. With IntegralHeight, you are ensured that no fractional entries in a control will be shown. This can improve the appearance of scrolling and increase the usability of important controls.

Windows Forms
.NET