ModuleListPage.SmallImageList Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the list of small images.
protected:
property System::Windows::Forms::ImageList ^ SmallImageList { System::Windows::Forms::ImageList ^ get(); };
protected System.Windows.Forms.ImageList SmallImageList { get; }
member this.SmallImageList : System.Windows.Forms.ImageList
Protected ReadOnly Property SmallImageList As ImageList
Property Value
The ImageList object.
Examples
The following example clears the large-image and small-image list collections and adds new images.
private void LoadPages() {
ListView.BeginUpdate();
try {
ImageList.ImageCollection largeImages
= LargeImageList.Images;
ImageList.ImageCollection smallImages
= SmallImageList.Images;
smallImages.Clear();
largeImages.Clear();
smallImages.Add("mySmallImg",
myGetImage(16));
largeImages.Add("myLargeImg",
myGetImage(32));
// Populate the list of features
IControlPanel controlPanel =
(IControlPanel)GetService(typeof(IControlPanel));
Debug.Assert(controlPanel != null,
"Couldn't get IControlPanel!");
Type moduleChildPageType =
typeof(IModuleChildPage);
ModulePageInfo controlPanelPage =
controlPanel.ControlPanelPage;
View view = ListView.View;
List<ListViewItem> itemsList =
new List<ListViewItem>();
foreach (ModulePageInfo pageInfo
in controlPanel.Pages) {
Type pageType = pageInfo.PageType;
// Don't add child, home
// or disabled pages
if (!moduleChildPageType.IsAssignableFrom(pageType) &&
(pageInfo != controlPanelPage) &&
pageInfo.IsEnabled) {
PageListViewItem newItem =
new PageListViewItem(pageInfo);
// Filter out pages that don't match
// current filter
if (!String.IsNullOrEmpty(
_filter.FilterStr) &&
newItem.Text.ToUpper().Contains(
_filter.FilterStr.ToUpper())
)
continue;
Image smallImage = (Image)pageInfo.SmallImage;
Image largeImage = (Image)pageInfo.LargeImage;
if (smallImage == null)
smallImage = myGetImage(16);
if (largeImage == null)
largeImage = myGetImage(32);
newItem.ImageKey = newItem.Text;
newItem.UpdateDescription(view);
itemsList.Add(newItem);
}
}
ListView.ListViewItemCollection items =
ListView.Items;
items.Clear();
items.AddRange(itemsList.ToArray());
if (SelectedGrouping != null)
OnGroup(SelectedGrouping);
if (view == View.SmallIcon)
((ListPageListView)ListView).View = view;
} finally {
ListView.EndUpdate();
Update();
}
}
Remarks
If the SmallImageList property has not been set, the get
accessor returns an empty System.Windows.Forms.ImageList object that has a size of 16 by 16 pixels and a color depth of 32 bits.