[Mono-winforms-list] Control resizing problem

Chris Bacon chris.bacon@docobo.co.uk
Thu, 3 Mar 2005 17:50:12 -0000


Hi,

I have latest SVN (41404) and there appears to be a problem with resizing
controls

When the test code supplied is run, the main window can be resized, but the
control (a listview) within the window does not resize correctly.
I've tracked the problem as far as the Hwnd.clientRect property, which is
returned wrong values. This may be because the configureNotify event in
XPlatUIX11 is setting it to a wrong value, but I don't know enough about how
the X system works to be certain.

(This also shows up a bug in ListView which causes it not to be displayed
properly after a resize)

Kind regards
Chris

Test code:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace TabControlTest1
{
 public class Form1 : System.Windows.Forms.Form
 {
  private System.Windows.Forms.ListView listView1;
  private System.Windows.Forms.ColumnHeader columnHeader1;
  private System.Windows.Forms.ColumnHeader columnHeader2;
  private System.Windows.Forms.ColumnHeader columnHeader3;
  private System.ComponentModel.Container components = null;

  public Form1()
  {
   InitializeComponent();
  }

  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if (components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

  private void InitializeComponent()
  {
   this.listView1 = new System.Windows.Forms.ListView();
   this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
   this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
   this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
   this.SuspendLayout();
   //
   // listView1
   //
   this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
                      this.columnHeader1,
                      this.columnHeader2,
                      this.columnHeader3});
   this.listView1.Dock = System.Windows.Forms.DockStyle.Fill;
   this.listView1.Location = new System.Drawing.Point(0, 0);
   this.listView1.Name = "listView1";
   this.listView1.Size = new System.Drawing.Size(544, 354);
   this.listView1.TabIndex = 0;
   this.listView1.View = System.Windows.Forms.View.Details;
   this.columnHeader1.Width = 100;
   this.columnHeader2.Width = 100;
   this.columnHeader3.Width = 100;
   //
   // Form1
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
   this.ClientSize = new System.Drawing.Size(552, 380);
   this.Controls.Add(this.listView1);
   this.Name = "Form1";
   this.Text = "Form1";
   this.ResumeLayout(false);

  }

  [STAThread]
  static void Main()
  {
   Application.Run(new Form1());
  }
 }
}