.NETGURU
ScrollBar In LidtView Detail
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.windowsforms.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

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[i].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);
}
-----------------------------------

--
Best Regards
---------------------------
Moldavanov Yura
ICQ#: 247077081
e-mail:Click here to reveal e-mail address

--
Best Regards
---------------------------
Moldavanov Yura
ICQ#: 247077081
e-mail:Click here to reveal e-mail address

Reply to this message...
 
    
mavisahdas (VIP)
Hi yura,

I think you can add ur code to the Paint event(overriding it) and try.
because everytime ur paint control will be called. Dont' place all the login.
just store the height and widht in some global object and retain it back in
the paint event

With regards,

Sadha Sivam S,
Microsoft Community Star,
KMG Info Tech,
Visit www.dotnetspider.com for more information on dot net
Reply to this message...
 
    
Yura Moldavanov
Thanks.

I think your advise is a realy good idea.

Also I can give an example of my solution this priblem which I found.
//------------------------------
private void OnParentResize(object sender, System.EventArgs e)
{
.............
}

protected override void OnParentChanged(EventArgs e)
{
if (this.Parent!=null)
{
this.Parent.Resize += new System.EventHandler(this.OnParentResize);
}
base.OnParentChanged (e);
}

//------------------------------

"mavisahdas" <Click here to reveal e-mail address> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ ×
ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.EventArgs
System.EventHandler
System.Windows.Forms.ListView
System.Windows.Forms.ScrollBar




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification