'宣言 Public Property View As UltraListViewStyle
public UltraListViewStyle View {get; set;}
Imports Infragistics.Win Imports Infragistics.Win.UltraWinListView Private Sub ultraListView1_ViewChanged(ByVal sender As System.Object, ByVal e As EventArgs) Handles ultraListView1.ViewChanged Dim listView As UltraListView = CType(sender, UltraListView) Select Case listView.View Case UltraListViewStyle.Details listView.ViewSettingsDetails.ImageList = Me.imageList16 listView.ViewSettingsDetails.ImageSize = New Size(16, 16) listView.ItemSettings.DefaultImage = Image.FromFile("Folder16.bmp") Case UltraListViewStyle.List listView.ViewSettingsList.ImageList = Me.imageList16 listView.ViewSettingsList.ImageList = Me.imageList16 listView.ItemSettings.DefaultImage = Image.FromFile("Folder16.bmp") Case UltraListViewStyle.Icons listView.ViewSettingsIcons.ImageList = Me.imageList32 listView.ViewSettingsIcons.ImageList = Me.imageList32 listView.ItemSettings.DefaultImage = Image.FromFile("Folder32.bmp") Case UltraListViewStyle.Tiles listView.ViewSettingsTiles.ImageList = Me.imageList48 listView.ViewSettingsTiles.ImageList = Me.imageList48 listView.ItemSettings.DefaultImage = Image.FromFile("Folder48.bmp") Case UltraListViewStyle.Thumbnails listView.ViewSettingsThumbnails.ImageList = Me.imageList48 listView.ViewSettingsThumbnails.ImageList = Me.imageList48 listView.ItemSettings.DefaultImage = Image.FromFile("Folder48.bmp") End Select End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinListView; using System.Diagnostics; private void ultraListView1_ViewChanged(object sender, System.EventArgs e) { UltraListView listView = sender as UltraListView; switch( listView.View ) { case UltraListViewStyle.Details: { listView.ViewSettingsDetails.ImageList = this.imageList16; listView.ViewSettingsDetails.ImageSize = new Size( 16, 16 ); listView.ItemSettings.DefaultImage = Image.FromFile( "Folder16.bmp" ); } break; case UltraListViewStyle.List: { listView.ViewSettingsList.ImageList = this.imageList16; listView.ViewSettingsList.ImageList = this.imageList16; listView.ItemSettings.DefaultImage = Image.FromFile( "Folder16.bmp" ); } break; case UltraListViewStyle.Icons: { listView.ViewSettingsIcons.ImageList = this.imageList32; listView.ViewSettingsIcons.ImageList = this.imageList32; listView.ItemSettings.DefaultImage = Image.FromFile( "Folder32.bmp" ); } break; case UltraListViewStyle.Tiles: { listView.ViewSettingsTiles.ImageList = this.imageList48; listView.ViewSettingsTiles.ImageList = this.imageList48; listView.ItemSettings.DefaultImage = Image.FromFile( "Folder48.bmp" ); } break; case UltraListViewStyle.Thumbnails: { listView.ViewSettingsThumbnails.ImageList = this.imageList48; listView.ViewSettingsThumbnails.ImageList = this.imageList48; listView.ItemSettings.DefaultImage = Image.FromFile( "Folder48.bmp" ); } break; } }