Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2004

Tip: Looking for answers? Try searching our database.

ScrollBar In LidtView Detail

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Yura Moldavanov - 30 Aug 2004 07:09 GMT
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);
}
-----------------------------------

Signature

Best Regards
---------------------------
Moldavanov Yura
ICQ#: 247077081
e-mail:universe_mind@rambler.ru

--
Best Regards
---------------------------
Moldavanov Yura
ICQ#: 247077081
e-mail:universe_mind@rambler.ru

mavisahdas - 31 Aug 2004 12:33 GMT
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
Yura Moldavanov - 03 Sep 2004 06:51 GMT
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);
}

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

> Hi yura,
>
[quoted text clipped - 9 lines]
> KMG Info Tech,
> Visit www.dotnetspider.com for more information on dot net

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.