To implement the the auto-size of the last column, subclass the ListView control, and override the WndProc method.protected override void WndProc( ref Message message )
{
const int WM_PAINT = 0xf ; // if the control is in details view mode and columns
// have been added, then intercept the WM_PAINT message
// and reset the last column width to fill the list view
switch ( message.Msg )
{
case WM_PAINT:
if ( this.View == View.Details && this.Columns.Count > 0 )
this.Columns[this.Columns.Count - 1].Width = -2 ;
break ;
} // pass messages on to the base control for processing
base.WndProc( ref message ) ;
}
{
const int WM_PAINT = 0xf ; // if the control is in details view mode and columns
// have been added, then intercept the WM_PAINT message
// and reset the last column width to fill the list view
switch ( message.Msg )
{
case WM_PAINT:
if ( this.View == View.Details && this.Columns.Count > 0 )
this.Columns[this.Columns.Count - 1].Width = -2 ;
break ;
} // pass messages on to the base control for processing
base.WndProc( ref message ) ;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货