Valhalla Legends Archive

Programming => General Programming => .NET Platform => Topic started by: iNsaNe on October 03, 2008, 06:46 PM

Title: ListView question
Post by: iNsaNe on October 03, 2008, 06:46 PM
This has somewhat to do with bot development

What properties do I need to set to have my listview display one user (item) per line, have vertical scrollbars ONLY, and have a second column (not sure if it actually is another column) that shows another image (example: latency)

(so that it looks like the Starcraft channel list)
Title: Re: ListView question
Post by: MyndFyre on October 03, 2008, 07:32 PM
You'd want to use owner-drawn listviews.

http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.drawitem(VS.80).aspx

I personally use a ListBox instead of a ListView but it's a matter of preference.
Title: Re: ListView question
Post by: iNsaNe on October 04, 2008, 12:59 AM
Thanks lol but one last question, sort of a beginner question too.

How do I make it so when I scroll the listbox (I changed to a listbox, you are right it is much easier) the images dont flicker. Like microsoft said, override DoubleBuffer but I'm not sure how? I'm doing this in C#
Title: Re: ListView question
Post by: MyndFyre on October 04, 2008, 02:15 AM
listBox.DoubleBuffered = true;
Title: Re: ListView question
Post by: brew on October 04, 2008, 07:11 AM
Override double buffering? It's never enabled by default. You'd have to either send an LVM_SETEXTENDEDLISTVIEWSTYLE message with LVS_EX_DOUBLEBUFFER as the style and mask, or (i guess) do it the way myndfyre said.

To display a listview the way starcraft does is extremely simple. Use the style LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SINGLESEL, and set LVS_EX_SUBITEMIMAGES as well (yes, it is a seperate column).
If you want your listview to have no horizontal scroll bar, check out ShowScrollBar() (http://msdn.microsoft.com/en-us/library/bb787601(VS.85).aspx).

Really, you should stick with a listview. It makes for less work and a more professional looking application in the end.
Title: Re: ListView question
Post by: l)ragon on October 04, 2008, 02:14 PM
As I remember the latest (going from when I last looked) listview control you can only have 1 image in the inital column and thats all, I remember haveing to build my own controll for my user list.
if I ever get back into this sort of crap again ill probably go with the listbox also.
Title: Re: ListView question
Post by: MyndFyre on October 05, 2008, 03:25 AM
Quote from: brew on October 04, 2008, 07:11 AM
Override double buffering? It's never enabled by default. You'd have to either send an LVM_SETEXTENDEDLISTVIEWSTYLE message with LVS_EX_DOUBLEBUFFER as the style and mask, or (i guess) do it the way myndfyre said.

To display a listview the way starcraft does is extremely simple. Use the style LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SINGLESEL, and set LVS_EX_SUBITEMIMAGES as well (yes, it is a seperate column).
If you want your listview to have no horizontal scroll bar, check out ShowScrollBar() (http://msdn.microsoft.com/en-us/library/bb787601(VS.85).aspx).

Really, you should stick with a listview. It makes for less work and a more professional looking application in the end.
This is the .NET forum.  Everything you described in this post has object-oriented APIs in .NET.
Title: Re: ListView question
Post by: brew on October 05, 2008, 07:35 AM
Quote from: MyndFyre[vL] on October 05, 2008, 03:25 AM
This is the .NET forum.  Everything you described in this post has object-oriented APIs in .NET.
So you mean a .NET developer can't use the powerful Win32 API just as well, or is less effective when using it? That must suck.
Title: Re: ListView question
Post by: l)ragon on October 05, 2008, 05:03 PM
Quote from: brew on October 05, 2008, 07:35 AM
Quote from: MyndFyre[vL] on October 05, 2008, 03:25 AM
This is the .NET forum.  Everything you described in this post has object-oriented APIs in .NET.
So you mean a .NET developer can't use the powerful Win32 API just as well, or is less effective when using it? That must suck.
Can use Win32 as much as we want, he's trying to tell you everything can mostly be done otherways in .NET.
Title: Re: ListView question
Post by: Barabajagal on October 05, 2008, 05:41 PM
Brew likes reinventing the wheel.
Title: Re: ListView question
Post by: Dale on October 05, 2008, 07:51 PM
Quote from: Andy on October 05, 2008, 05:41 PM
Brew likes reinventing the wheel.

(http://bp0.blogger.com/_OroNfSICBo4/SDQsU9yL9gI/AAAAAAAAAlQ/mUMwC9Bcofc/s400/square+wheel.jpg)
Brew, age 9.
Title: Re: ListView question
Post by: brew on October 05, 2008, 09:06 PM
It's hip to be square.