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 / February 2005

Tip: Looking for answers? Try searching our database.

listview scrollbar range not correct

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GP - 15 Feb 2005 19:27 GMT
I implemented a double buffered listview to eliminate flicker.  I set the
following styles, then overrode OnPaint and did the drawing. Everything looks
great! However, if I change the font from default, the column headers are not
drawn with the new font and worse yet the scrollbar doesn't know that  font
height has changed and I can never scroll to see the last few items on the
list.

Short of  adding my own scrollbar, is there a way to let the column headers
and scrollbar know about the new "range" when the font is changed?

        SetStyle(ControlStyles.DoubleBuffer, true);
        SetStyle(ControlStyles.UserPaint, true);
        SetStyle(ControlStyles.AllPaintingInWmPaint , true);
VBen - 15 Feb 2005 19:36 GMT
Set DrawMode of the listbox:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemwindowsformscomboboxclassdrawmodetopic.asp
You have to override the OnDrawItem AND the OnMeasureItem (or handle the
DrawItem and MeasureItem events) to do the trick. The OnMeasureItem lets you
set the size of each element of the list, so the scrollbar gets sized
correctly:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemwindowsformscomboboxclassdrawmodetopic.asp
Hope this helps.
VBen.

> I implemented a double buffered listview to eliminate flicker.  I set the
> following styles, then overrode OnPaint and did the drawing. Everything looks
[quoted text clipped - 9 lines]
>          SetStyle(ControlStyles.UserPaint, true);
>          SetStyle(ControlStyles.AllPaintingInWmPaint , true);
GP - 15 Feb 2005 20:51 GMT
Thanks so much for your reply. Unfortunately it doesn't look like a ListView
has a DrawMode property or OnDrawItem and OnMeasureItem events. I was hoping
to use a ListView to take advantage of the built in colums and being able to
add subitems.

> Set DrawMode of the listbox:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
[quoted text clipped - 25 lines]
> >          SetStyle(ControlStyles.UserPaint, true);
> >          SetStyle(ControlStyles.AllPaintingInWmPaint , true);

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.