[Mono-bugs] [Bug 76821][Nor] New - Alignment of column titles in ListView

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Nov 25 07:12:37 EST 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 aviary.tree at ntlworld.com.

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

--- shadow/76821	2005-11-25 07:12:37.000000000 -0500
+++ shadow/76821.tmp.20107	2005-11-25 07:12:37.000000000 -0500
@@ -0,0 +1,145 @@
+Bug#: 76821
+Product: Mono: Class Libraries
+Version: 1.1
+OS: other
+OS Details: SUSE 10
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Windows.Forms
+AssignedTo: peter at novonyx.com                            
+ReportedBy: aviary.tree at ntlworld.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Alignment of column titles in ListView
+
+Description of Problem:
+For ListView in Details mode if column titles are defined with Horizontal
+Alignment Right, the title text and data beneath do not appear in the
+correct place. 
+
+This is mono 1.1.10 (latest RPMs from the mono downloads) running on SUSE
+10.  Message on execution:
+Mono System.Windows.Forms Assembly [Revision: 51965; built: 2005/10/20 3:34:45]
+
+Steps to reproduce the problem:
+1. Compile the accompanying code, adjusting the directory to something
+containing some suitable and accessible files.  You may need to find an
+appropriate icon file, or just cut out the imagelist, it's not essential.
+This code defines a listview in Details mode with three column headings
+aligned to the right, and populates the listview with some directory data.
+2. Run it.  You will see the wrongly aligned column heading text, and the
+file names, sizes and dates wrongly aligned to the left.
+3. Press Dismiss to get rid of the program.
+
+Actual Results:
+1) The title text gets shifted into the column on the left, possibly
+over-writing the other column's title text.
+2) The data under the column title is not aligned to the right. The text in
+each column is aligned to the left, as for H.A. = left.
+
+Expected Results:
+1) The column heading text should be aligned to the right for each column
+where Horizontal Alignment is set to the Right.
+2) The data in the ListView lines under the column heading should also be
+aligned to the right.
+
+How often does this happen? 
+Every time H.A. Right is used. It's OK for H.A. Left.  Absence or presence
+of icon images has no effect.
+
+Additional Information:
+
+Test code (verification requires visual inspection):
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.IO;
+
+namespace listview1
+{
+	class MainForm : System.Windows.Forms.Form
+	{
+		private System.Windows.Forms.Button btnDismiss;
+		private System.Windows.Forms.ListView listView1;		
+		private ImageList imageList1;
+
+		public MainForm()
+		{
+			InitializeComponent();
+			listView1.Columns.Add("File Name", 100, HorizontalAlignment.Right);
+			listView1.Columns.Add("File Size", 60, HorizontalAlignment.Right);
+			listView1.Columns.Add("Creation date", 80, HorizontalAlignment.Right);
+			imageList1 = new ImageList () ;
+
+ 			Icon icon1 = new Icon("icon1.ico");  // Note the icon file
+ 			imageList1.Images.Add(icon1);
+ 			listView1.SmallImageList = imageList1;
+
+			ShowFiles("/home/barry");   // you will probably need to change this
+directory
+
+		}
+		void InitializeComponent() {
+			this.listView1 = new System.Windows.Forms.ListView();
+			this.btnDismiss = new System.Windows.Forms.Button();
+			this.SuspendLayout();
+			// 
+			// listView1
+			// 
+			this.listView1.GridLines = true;
+			this.listView1.Location = new System.Drawing.Point(16, 16);
+			this.listView1.Name = "listView1";
+			this.listView1.Size = new System.Drawing.Size(256, 184);
+			this.listView1.TabIndex = 0;
+			this.listView1.View = System.Windows.Forms.View.Details;
+			// 
+			// btnDismiss
+			// 
+			this.btnDismiss.Location = new System.Drawing.Point(104, 224);
+			this.btnDismiss.Name = "btnDismiss";
+			this.btnDismiss.Size = new System.Drawing.Size(72, 24);
+			this.btnDismiss.TabIndex = 1;
+			this.btnDismiss.Text = "Dismiss";
+			this.btnDismiss.Click += new System.EventHandler(this.BtnDismissClick);
+			// 
+			// MainForm
+			// 
+			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+			this.ClientSize = new System.Drawing.Size(292, 266);
+			this.Controls.Add(this.btnDismiss);
+			this.Controls.Add(this.listView1);
+			this.MaximizeBox = false;
+			this.Name = "MainForm";
+			this.Text = "Test Form - Listview1";
+			this.ResumeLayout(false);
+		}
+		[STAThread]
+		public static void Main(string[] args)
+		{
+			Application.Run(new MainForm());
+		}
+		private void ShowFiles(string dirname)
+		{
+		  DirectoryInfo di = new DirectoryInfo(dirname);		
+		  // Get a collection of all files in the directory.
+		  FileInfo[] fiArr = di.GetFiles();
+		  // Display the names, size and modification date of the files in the
+ListView.
+			listView1.Items.Clear();
+			foreach (FileInfo fi in fiArr) {
+				ListViewItem lvItem = listView1.Items.Add(fi.Name, 0);		
+				lvItem.SubItems.Add(fi.Length.ToString()); 
+				lvItem.SubItems.Add(fi.LastWriteTime.ToShortDateString());	
+			}
+		}		
+		void BtnDismissClick(object sender, System.EventArgs e)
+		{
+			Application.Exit();
+		}		
+	}
+}


More information about the mono-bugs mailing list