private bool CheckScrollBars()
{
// Horizontal scroll bar
bool hScrollRequired = false;
bool hScrollChanged = false;
if (mImageListView.ScrollBars)
hScrollRequired = (mImageListView.Items.Count > 0) && (mItemAreaBounds.Width < totalWidth);
if (hScrollRequired != hScrollVisible)
{
hScrollVisible = hScrollRequired;
mImageListView.hScrollBar.Visible = hScrollRequired;
hScrollChanged = true;
}
// Vertical scroll bar
bool vScrollRequired = false;
bool vScrollChanged = false;
if (mImageListView.ScrollBars)
vScrollRequired = (mImageListView.Items.Count > 0) && (mItemAreaBounds.Height < totalHeight);
if (vScrollRequired != vScrollVisible)
{
vScrollVisible = vScrollRequired;
mImageListView.vScrollBar.Visible = vScrollRequired;
vScrollChanged = true;
}
// Determine if the layout needs to be recalculated
return (hScrollChanged || vScrollChanged);
}