Click here to Skip to main content
15,562,550 members
Home / Discussions / C#
   

C#

 
GeneralCustom Attributes Pin
pnolan14-Jan-04 14:53
pnolan14-Jan-04 14:53 
GeneralRe: Custom Attributes Pin
Heath Stewart15-Jan-04 4:55
protectorHeath Stewart15-Jan-04 4:55 
GeneralI still didn't found what I was looking for - C# Service installation Pin
Pinho14-Jan-04 13:53
Pinho14-Jan-04 13:53 
GeneralRe: I still didn't found what I was looking for - C# Service installation Pin
Heath Stewart15-Jan-04 4:50
protectorHeath Stewart15-Jan-04 4:50 
GeneralNeed several listviews to all sort at same time...or a listview that can have subitems that each have their own icon Pin
FocusedWolf14-Jan-04 13:45
FocusedWolf14-Jan-04 13:45 
GeneralRe: Need several listviews to all sort at same time...or a listview that can have subitems that each have their own icon Pin
FocusedWolf14-Jan-04 13:50
FocusedWolf14-Jan-04 13:50 
GeneralNeed several listviews to all sort at same time...or a listview that can have subitems that each have their own icon Pin
FocusedWolf14-Jan-04 13:45
FocusedWolf14-Jan-04 13:45 
GeneralRe: Need several listviews to all sort at same time...or a listview that can have subitems that each have their own icon Pin
Heath Stewart15-Jan-04 4:44
protectorHeath Stewart15-Jan-04 4:44 
The first thing is to understand that the ListView class in .NET encapsulates the List-View common control in Windows, as do most controls in the System.Windows.Forms namespace, so doing things like this will typically required that you extend ListView, override WndProc, and handle notification messages. Some Windows programming background will be helpful. You'll also want to know how to P/Invoke native methods. You can find more information in the documentation for the DllImportAttribute in the .NET Framework SDK.

You'll have to handle the drawing of each subitem by handling the NM_CUSTOMDRAW notification message. That will give you a struct (which you'll have to create, namely the NMLVCUSTOMDRAW struct). From information in that you can adjust the starting location of your text (though you'll have to draw it yourself, though that's not hard) and then paint the icon you want next to it. You'll have to figure out how to store that image information, though, be it an index into an ImageList or an Image itself. You could extend ListViewSubItem although you'll have to worry about casting each time.

Note that this may sound like a lot of work (and I'll admit it's not trivial) but it sure beats making your own list view control from scratch! There's a heck of a lot more to worry about than this. In the grand scheme of things, this approach is easy.

If you reply to this, I can send you some old source that shows some examples of owner-drawing. Though not specific to your requirements, it should give you some insight.

Again, be sure to read about the list-view common control at http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/listview/reflist.asp[^] and read about P/Invoking at http://msdn.microsoft.com/library/en-us/cpguide/html/cpconconsumingunmanageddllfunctions.asp[^]. Again, some Windows programming experience will be helpful.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: Need several listviews to all sort at same time...or a listview that can have subitems that each have their own icon Pin
FocusedWolf15-Jan-04 18:43
FocusedWolf15-Jan-04 18:43 
GeneralTaskbar Grouping Icon and Text in Windows XP Pin
Sascha Sertel14-Jan-04 13:19
Sascha Sertel14-Jan-04 13:19 
GeneralRe: Taskbar Grouping Icon and Text in Windows XP Pin
Heath Stewart15-Jan-04 7:12
protectorHeath Stewart15-Jan-04 7:12 
GeneralDisplaying Multidimensional Arrays in a Form Pin
crushinghellhammer14-Jan-04 12:56
crushinghellhammer14-Jan-04 12:56 
GeneralRe: Displaying Multidimensional Arrays in a Form Pin
Christian Graus14-Jan-04 13:03
mveChristian Graus14-Jan-04 13:03 
GeneralRe: Displaying Multidimensional Arrays in a Form Pin
Colin Angus Mackay14-Jan-04 13:07
Colin Angus Mackay14-Jan-04 13:07 
GeneralIsInputKey override for cursors not working Pin
cgcrute14-Jan-04 12:37
cgcrute14-Jan-04 12:37 
GeneralRe: IsInputKey override for cursors not working Pin
cgcrute14-Jan-04 22:42
cgcrute14-Jan-04 22:42 
General.NET remoting book Pin
naxos14-Jan-04 11:58
naxos14-Jan-04 11:58 
GeneralRe: .NET remoting book Pin
Giles14-Jan-04 12:14
Giles14-Jan-04 12:14 
GeneralRe: .NET remoting book Pin
Mohamad Al Husseiny14-Jan-04 20:34
Mohamad Al Husseiny14-Jan-04 20:34 
GeneralCd Detection to start App Pin
antoine@orchus-tech14-Jan-04 11:54
antoine@orchus-tech14-Jan-04 11:54 
GeneralRe: Cd Detection to start App Pin
Meysam Mahfouzi14-Jan-04 19:30
Meysam Mahfouzi14-Jan-04 19:30 
GeneralFloating Window Z-Order.... Pin
Anders Molin14-Jan-04 9:50
professionalAnders Molin14-Jan-04 9:50 
GeneralRe: Floating Window Z-Order.... Pin
Niels Penneman14-Jan-04 9:53
Niels Penneman14-Jan-04 9:53 
GeneralRe: Floating Window Z-Order.... Pin
Anders Molin14-Jan-04 10:10
professionalAnders Molin14-Jan-04 10:10 
GeneralRe: Floating Window Z-Order.... Pin
Niels Penneman14-Jan-04 10:15
Niels Penneman14-Jan-04 10:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.