[Mono-bugs] [Bug 75696][Wis] New - ListView not showing icons

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Aug 2 19:53:46 EDT 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by paul at all-the-johnsons.co.uk.

http://bugzilla.ximian.com/show_bug.cgi?id=75696

--- shadow/75696	2005-08-02 19:53:46.000000000 -0400
+++ shadow/75696.tmp.22400	2005-08-02 19:53:46.000000000 -0400
@@ -0,0 +1,158 @@
+Bug#: 75696
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: Fedora Core 4
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Windows.Forms
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: paul at all-the-johnsons.co.uk               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: ListView not showing icons
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+The code in the additional information when compiled is not behaving
+correctly in that it is not displaying any icons (I have taken some stock
+FC4 ones and resized them).
+
+I'm not sure if it's related, but the listview when the app is run does not
+update when the window movement side bars (up/down) are moved (in other
+words, you don't see a full directory listing)
+
+Steps to reproduce the problem:
+1. Compile and run the source code.
+2. Click for large or small icons
+3. To see the problem with the non-movement of the directory view, run in a
+directory with a lot of files in.
+
+Actual Results:
+Icons are not shown for large or small selection, only the first so many
+files are listed in the directory view.
+
+Expected Results:
+Icons should display and the directory view should also scroll the filenames.
+
+How often does this happen? 
+Always
+
+Additional Information:
+If you add in the line
+
+System.Console.WriteLine("View Desired: " + viewDesired);
+
+on exit, a pile of throwback is given complaining of a double linked list
+corruption.
+
+using System;
+using System.IO;
+using System.Drawing;
+using System.Windows.Forms;
+
+class ListViewDemo : Form
+{
+  ListView lv;
+
+  ListViewDemo()
+  {
+    Panel p = new Panel();
+    RadioButton[] btn = new RadioButton[]
+      {
+	new RadioButton(), new RadioButton(), new RadioButton(),
+	new RadioButton()
+      };
+    btn[0].Checked = true;
+    btn[0].Text = "Details";
+    btn[1].Text = "Large Icons";
+    btn[2].Text = "List";
+    btn[3].Text = "Small Icons";
+
+    for (int i = 0; i < 4; i++)
+    {
+      btn[i].Location = new Point(10, 20 * (i + 1));
+      btn[i].CheckedChanged += new EventHandler(SelectView);
+    }
+    p.Controls.AddRange(btn);
+    p.Dock = DockStyle.Left;
+    p.Width = 100;
+
+    Splitter s = new Splitter();
+    s.Dock = DockStyle.Left;
+
+    lv = new ListView();
+    lv.Dock = DockStyle.Fill;
+
+    lv.Columns.Add("File Name", 150, HorizontalAlignment.Left);
+    lv.Columns.Add("Size", 150, HorizontalAlignment.Left);
+    lv.View = View.Details;
+
+    Image smallCS = Image.FromFile("cs_sm.jpg");
+    Image smallExe = Image.FromFile("exe_sm.jpg");
+    ImageList il = new ImageList();
+    il.Images.Add(smallCS);
+    il.Images.Add(smallExe);
+    lv.SmallImageList = il;
+
+    Image largeCS = Image.FromFile("cs_lrg.jpg");
+    Image largeExe = Image.FromFile("exe_lrg.jpg");
+    ImageList il2 = new ImageList();
+    il2.Images.Add(largeCS);
+    il2.Images.Add(largeExe);
+    lv.LargeImageList = il2;
+
+    DirectoryInfo dir = new DirectoryInfo(".");
+    foreach (FileInfo f in dir.GetFiles("*.*"))
+    {
+      string fName = f.Name;
+      string size = f.Length.ToString();
+      string ext = f.Extension;
+
+      ListViewItem item = new ListViewItem(fName);
+      if (ext == ".cs")
+	item.ImageIndex = 0;
+      else
+	item.ImageIndex = 1;
+      item.SubItems.Add(size);
+      lv.Items.Add(item);
+    }
+
+    Controls.Add(lv);
+    Controls.Add(s);
+    Controls.Add(p);
+    Width = 640;
+  }
+
+  public void SelectView(object src, EventArgs ea)
+  {
+    RadioButton rb = (RadioButton) src;
+    string viewDesired = rb.Text;
+    System.Console.WriteLine("Desired View : " + viewDesired);
+    switch (viewDesired)
+    {
+    case "Details" :
+      lv.View = View.Details;
+      break;
+    case "Large Icons" :
+      lv.View = View.LargeIcon;
+      break;
+    case "List" :
+      lv.View = View.List;
+      break;
+    case "Small Icons" :
+      lv.View = View.SmallIcon;
+      break;
+    }
+  }
+
+  public static void Main()
+  {
+    Application.Run(new ListViewDemo());
+  }
+}


More information about the mono-bugs mailing list