Operating System Windows 7.0
Developement Enviroment Visual Studio 2010 Version 10.0.40219 Sp1 Rel
Framework Microsoft .NetFramework Version 4.0.30319Sp1Rel
I have a Listview control in my windows form.The scrollable property of Listview control is set true. This issue occurs wnhen we resize the windows form some times Listview control is not able paint properly. This is related to scollable property of ListView
control. I gone through the following MSDN link
http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.scrollable.aspx
In notes segment MSDN states that
In versions of the .NET Framework prior to version 2.0, the column headers were not painted correctly when setting this property to false and resizing the control to make it larger. To work around this issue, set this property to true in a ResizeBegin event
handler and set it back to false in a ResizeEnd event handler.
I think this issue is still in .Net frame work, but happens when the the scrollable property is true and when we resize the window.
Following is the ListView initialization code
this._listView2.Anchor = ((System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)| System.Windows.Forms.AnchorStyles.Left)));
this._listView2.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this._name2ColumnHeader,
this._valueColumnHeader});
this._listView2.FullRowSelect = true;
this._listView2.GridLines = true;
this._listView2.HideSelection = false;
this._listView2.Location = new System.Drawing.Point(376, 40);
this._listView2.MultiSelect = false;
this._listView2.Name = "_listView2";
this._listView2.Size = new System.Drawing.Size(304, 192);
this._listView2.Sorting = System.Windows.Forms.SortOrder.Ascending;
this._listView2.TabIndex = 5;
this._listView2.UseCompatibleStateImageBehavior = false;
this._listView2.View = System.Windows.Forms.View.Details;
this._listView2.SelectedIndexChanged += new System.EventHandler(this._listView2_SelectedIndexChanged);
this._listView2.Layout += new System.Windows.Forms.LayoutEventHandler(this._listView2_Layout);
void _listView2_Layout(object sender, System.Windows.Forms.LayoutEventArgs e) {
if (_listView2== null) {
return;
}
int columnWidths = 0;
for (int i = 0; i < _listView2.Columns.Count - 1; ++i) {
columnWidths += listView.Columns[i].Width;
}
_listView2.Columns[_listView2.Columns.Count - 1].Width = _listView2.ClientSize.Width - columnWidths;
}
Steps to reproduce
2. Resize above window to bottom of screen until the vertical scrollbar get invisible.(Scroll below the bottom taskbar).
3. Now release the mouse. Now you will able to see the vertical scroll bar again after releasing the mouse.
4. scroll vertical scrollbar to last item of list view.
5. Repeat step 2.