[Mono-bugs] [Bug 425360] New: ListView: SubItems Incorrect vertical text alignment

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Sep 11 01:36:21 EDT 2008


           Summary: ListView: SubItems Incorrect vertical text alignment
           Product: Mono: Class Libraries
           Version: SVN
          Platform: i386
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: johnm at hlaustralia.com.au
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

Description of Problem:

When using a non-standard listitem height the sub items are not vertically
aligned correctly. However the first column is aligned correctly.

Sample Code.

using System;
using System.Drawing;
using System.Windows.Forms;

public class test
        static void Main ()
                Form f = new Form ();

                ImageList imgList = new ImageList();
                imgList.ImageSize = new Size(1, 32);

                ListView lv = new ListView();
                lv.Dock = DockStyle.Fill;
                lv.Columns.Add(new ColumnHeader());
                lv.Columns.Add(new ColumnHeader());        
                lv.View = View.Details;
                lv.FullRowSelect = true;
                lv.SmallImageList = imgList;
                for (int i = 0; i < 20; i++)
                        ListViewItem item = lv.Items.Add("Item");

                lv.Parent = f;
                Application.Run (f);

Actual Results:
First column is aligned, others are not.

Expected Results:
All columns aligned the same (vertical center)

How often does this happen? 
Every time.

Additional Information:

This following code appears to fix the problem.

Index: ThemeWin32Classic.cs
--- ThemeWin32Classic.cs        (revision 112742)
+++ ThemeWin32Classic.cs        (working copy)
@@ -1,4 +1,4 @@
-// Permission is hereby granted, free of charge, to any person obtaining
+// Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // "Software"), to deal in the Software without restriction, including
 // without limitation the rights to use, copy, modify, merge, publish,
@@ -3027,6 +3027,7 @@
                        format.Alignment = col.Format.Alignment;
                        format.FormatFlags = StringFormatFlags.NoWrap;
                        format.Trimming = StringTrimming.EllipsisCharacter;
+                       format.LineAlignment = StringAlignment.Center;

                        Rectangle sub_item_rect = subItem.Bounds;
                        Rectangle sub_item_text_rect = sub_item_rect;

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list