I have a C # WinForm application where I am using a list view to show that in my database What files are uploaded? I use the same code every time, calls LoadFile Attachments () when the form loads, and then at any time I refresh the list , Or add or remove additional attachments from the database. (This part works great)
Wherever I am having a problem is the GUI side of the list view. For the first time LoadFileAttachments () runs and fills the ListView, there is a difference between the ListView and the left side of the attachment on the subsequent calls, the difference disappears.
As you can see below, column widths are not changing, only difference seems to me that I tried to capture the mapclick event of the list and see in the listWhat are there to see using VitaTestInfo? , And it is showing the item that is located next to the property of "selected = false". Clicking on the icon or text item is selected, but not in the difference.
What's the interval?
Screenshots:
I call every time:
Private Zero LoadFile Attachments () {AttachmentListView.Items.Clear (); Imagist Iconist = New ImageList (); AttachmentListView.LargeImageList = iconList; AttachmentListView.SmallImageList = iconList; AttachmentListView.StateImageList = iconList; File attachmentinfo [] fileAttach = dbAccess.RetrieveAttachedRecords (loadPNGid.Value); Foreign currency (fileAttachment in fileAttachmentInfo file) {ListViewItem Item = New ListViewItem (file.FileName); Item.Tag = file ROWID; IconList.Images.Add (file.FileExtention, ExtractIcons.GetIconImage (file.FileExtention)); Item.ImageKey = file. File specified; Item.SubItems.Add (GetFileTypeDescriptors.GetFileDescriptor (file.FileExtention)); Item.SubItems.Add (Conversions.FileSizeToString (file.FileSize)); Item.SubItems.Add (file.DateAdded.ToShortDateString ()); AttachmentListView.Items.Add (item); } If (attachmentListView.Columns.Count == 0) {attachmentListView.Columns.Add ("attachment", 150); AttachmentListView.Columns.Add ("File Type", -2); AttachmentListView.Columns.Add ("Size", -2); AttachmentListView.Columns.Add ("Date added", -2); }} The code in this designer file is:
// // Attached LISTView // this.attachmentListView.AllowColumnReorder = true; This.attachmentListView.Font = New system.drawing.fonts ("Segoyi UI", 9F, System.Downings.FontSystemRegular, System Drawing.GraphicUnitPoint, ((Byte) (0)); This.attachmentListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; This.attachmentListView.Location = New system. Drawing Points (0, 0); This.attachmentListView.MultiSelect = false; This.attachmentListViewName = "attachmentListView"; This.attachmentListView.Size = New system Drawing Size (440, 301); This.attachmentListView.TabIndex = 0; This.attachmentListView.TileSize = New system Drawing. Size (188, 130); This.attachmentListView.UseCompatibleStateImageBehavior = false; This.attachmentListView.View = System.Windows.Forms.View.Details; This.attachmentListView.DoubleClick + = New System EventHandler (this.attachmentListView_DoubleClick); This.attachmentListView.MouseClick + = New system. Windows .form. MuseEventHandler (this.attachmentListView_MouseClick);
I believe the problem is according to the StateImageList property documentation SmallImageList .
StateImageListproperty allows you to specify an image list in which a list-view control is used to represent an application-specific status of an item Containing images. State images are displayed on the left side of the icon. You can use state images to indicate app-defined item states, such as checks and unchecked check boxes. State picture lists are visible in all views of visual control.
Try commenting on it and see if it resolves your problem.
Comments
Post a Comment