Y
Yura Moldavanov
Hello, Everybody!
I have problem in myListView control, inherited from ListView Class
I try to calculate width of some Column in LisrView (Detail) when after
resizing.
For this purpose I override OnResize method (see code below)
if I extend width of the MyListView - That's All OK.
BUT if I try to narrow the MyListView - I take the Horizontal ScrollBar,
which realy not need.
(After minimize/restore operation ScrollBar id diapear)
How to fix this bug?
Please, help.
private int m_iAlignColIndex = 1; // aligh 1 column
private int m_iMinWidth; //Minimum align column width value;
-----------------------------------
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
this.SuspendLayout();
if (this.Columns.Count>1)
{
int width=Width-4;
for (int i=0; i<this.Columns.Count; i++)
{
if (i!=m_iAlignColIndex) width-=this.Columns.Width;
}
if (width<m_iMinWidth)
{
this.Columns[m_iAlignColIndex].Width=m_iMinWidth; // Set Minimum
Width and in this case we NEED ScrollBar
}
else
{
Columns[m_iAlignColIndex].Width=width;// In this place We DON"T
NEED ScrollBar
}
}
this.ResumeLayout(true);
}
I have problem in myListView control, inherited from ListView Class
I try to calculate width of some Column in LisrView (Detail) when after
resizing.
For this purpose I override OnResize method (see code below)
if I extend width of the MyListView - That's All OK.
BUT if I try to narrow the MyListView - I take the Horizontal ScrollBar,
which realy not need.
(After minimize/restore operation ScrollBar id diapear)
How to fix this bug?
Please, help.
private int m_iAlignColIndex = 1; // aligh 1 column
private int m_iMinWidth; //Minimum align column width value;
-----------------------------------
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
this.SuspendLayout();
if (this.Columns.Count>1)
{
int width=Width-4;
for (int i=0; i<this.Columns.Count; i++)
{
if (i!=m_iAlignColIndex) width-=this.Columns.Width;
}
if (width<m_iMinWidth)
{
this.Columns[m_iAlignColIndex].Width=m_iMinWidth; // Set Minimum
Width and in this case we NEED ScrollBar
}
else
{
Columns[m_iAlignColIndex].Width=width;// In this place We DON"T
NEED ScrollBar
}
}
this.ResumeLayout(true);
}