Click here to Skip to main content
13,630,937 members
Click here to Skip to main content
Add your own
alternative version


36 bookmarked
Posted 5 Aug 2009
Licenced CPOL

ListView Watermark in VB.NET

, 26 Oct 2013
Rate this:
Please Sign up or sign in to vote.
Code to add a watermark to a ListView using the LVBKIF_TYPE_WATERMARK flag

Vista Themeing Enabled
Vista Themeing Disabled
Windows Vista/Windows 7 Screenshot


  • Added the code suggested by rojaldearintok
  • Also, no longer ignores item background color. However, the item's background color will appear transparent, so that the watermark will still show through.
  • Added a property called UseVistaThemeing

Changes as of September 02, 2013

  • Added property called ShowFocusRectangle - Haven't figured out how to Show/Hide the focus-rect during run-time. Must be set at design-time.

  • Bug Fixed: Horizontal Scrolling leaving a white space. No longer does this. Problem lay in the ItemDraw Event where I was setting the draw area to the ClientRectangle.Width. Now checks to see if the Item's Rectangle.Width is larger or less than the ClientRectangle.Width.

Changes as of October 26, 2013

  • Added property UseLedgerStyle, LedgerStyleDarkColor, LedgerStyleLightColor, ColumnSortIndex, ColumnSortOrder, ColumnSortStyle.

    1. UseLedgerStyle: Set to true to show a list of items with alternating colors per row
    2. LedgerStyleDarkColor: Color of an even numbered index
    3. LedgerStyleLightColor: Color of an odd numbered index
    4. ColumnSortIndex: Index of the Column to sort by
    5. ColumnSortOrder: Indicates how to sort the items. Ascending/Descending
    6. ColumnSortStyle: What to sort by (Image, Text, or Checkbox)
  • Added SubItemClick, and SubItemDoubleClick Events:
    1. SubItemClick: Fires when a subitem is clicked. EventArgs has property that indicates the subitem that was clicked along with its owner Item.
    2. SubItemDoubleClick: Fires when a subitem is Doubleclicked. EventArgs has property that indicates the subitem that was clicked along with its owner Item.
  • Changed project name to ProjectListview, since this has become a collaboration of code.

Changes as of January 2, 2014

  • Fixed bug with ledgerstyledarkcolor being present at runtime when switching ledgerstyle on/off after setting the watermark image. (I've had this update done for a while, but got really busy with work and hadn't had the time to upload it.

Changes as of December 20, 2014

  • No longer causes generic GDI+ error
  • Notice 2: You will see 2 cListView classes in the solution included in the zip file. I am working on moving the control to a separate library for full customization of the listview. I plan on adding custom column types such as boolean, button, etc.
  • Item backcolors work properly. You can now switch to and from Ledger style without the colors being messed up. Example: If you add an item with a red background and you happen to default to Ledger Style, the list will be drawn with the Ledger colors. If UseLedger is False, then the item will be drawn with a red background.

Future Plans

Special Column Types: checkbox, progressbar, etc. ColumnHeader themeing. FixedColumnWidth.


This code uses the LVBKIF_TYPE_WATERMARK flag of LVBKIMAGE to put a watermark in the lower right corner of a ListView control.

Using the Code

The zip file above includes a class that inherits the ListView. Add the class to your solution, and build the solution. In the control's toolbox, you'll see the cListView added. Drag one onto the form and set its WatermarkImage property to the desired image you want. Also, set the WatermarkAlpha property to the desired translucency. It will support any image file that VB.NET can open. It will automatically convert the image to the needed bitmap.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

United States United States
Self Taught Programmer. Programming is one of many Hobbies that I enjoy doing. Started learning back in 2001 when I discovered how the template wizards worked for Microsoft Office. Have learned lots, and am still learning.

You may also be interested in...

Comments and Discussions

SuggestionMessage Text when ListView is Empty Pin
rojaldearintok15-Jan-15 3:24
memberrojaldearintok15-Jan-15 3:24 
BugGDI+ Error Pin
rojaldearintok7-Dec-14 4:06
memberrojaldearintok7-Dec-14 4:06 
GeneralRe: GDI+ Error Pin
clwprogrammer7-Dec-14 10:15
memberclwprogrammer7-Dec-14 10:15 
GeneralRe: GDI+ Error Pin
rojaldearintok7-Dec-14 16:25
memberrojaldearintok7-Dec-14 16:25 
GeneralRe: GDI+ Error Pin
clwprogrammer8-Dec-14 13:44
memberclwprogrammer8-Dec-14 13:44 
GeneralRe: GDI+ Error Pin
rojaldearintok8-Dec-14 15:23
memberrojaldearintok8-Dec-14 15:23 
GeneralRe: GDI+ Error Pin
clwprogrammer8-Dec-14 15:27
memberclwprogrammer8-Dec-14 15:27 
GeneralRe: GDI+ Error Pin
rojaldearintok8-Dec-14 16:46
memberrojaldearintok8-Dec-14 16:46 
GeneralRe: GDI+ Error Pin
clwprogrammer9-Dec-14 16:07
memberclwprogrammer9-Dec-14 16:07 
GeneralRe: GDI+ Error Pin
rojaldearintok12-Dec-14 22:49
memberrojaldearintok12-Dec-14 22:49 
GeneralRe: GDI+ Error Pin
clwprogrammer19-Dec-14 20:10
memberclwprogrammer19-Dec-14 20:10 
GeneralRe: GDI+ Error Pin
rojaldearintok20-Dec-14 17:38
memberrojaldearintok20-Dec-14 17:38 
GeneralRe: GDI+ Error Pin
clwprogrammer21-Dec-14 15:27
memberclwprogrammer21-Dec-14 15:27 
GeneralThanks Bro Pin
rojaldearintok20-Jan-14 3:38
memberrojaldearintok20-Jan-14 3:38 
Bugbug Pin
rojaldearintok8-Nov-13 7:25
memberrojaldearintok8-Nov-13 7:25 
SuggestionSuggestion: Add Column Sorting and Alternate Rows, (maybe some bugs) Pin
rojaldearintok6-Oct-13 3:10
memberrojaldearintok6-Oct-13 3:10 
BugBug Found Pin
rojaldearintok2-Sep-13 7:27
memberrojaldearintok2-Sep-13 7:27 
GeneralRe: Bug Found Pin
clwprogrammer2-Sep-13 14:57
memberclwprogrammer2-Sep-13 14:57 
QuestionUPDATED!!!!! Pin
clwprogrammer30-Aug-13 4:48
memberclwprogrammer30-Aug-13 4:48 
AnswerRe: UPDATED!!!!! Pin
rojaldearintok31-Aug-13 22:38
memberrojaldearintok31-Aug-13 22:38 
GeneralRe: UPDATED!!!!! Pin
clwprogrammer1-Sep-13 13:27
memberclwprogrammer1-Sep-13 13:27 
AnswerRe: UPDATED!!!!! Pin
rojaldearintok2-Sep-13 3:55
memberrojaldearintok2-Sep-13 3:55 
GeneralAdd some code hope you dont mind, to have a Vista theme Pin
rojaldearintok29-Aug-13 7:14
memberrojaldearintok29-Aug-13 7:14 
GeneralRe: Add some code hope you dont mind, to have a Vista theme Pin
clwprogrammer29-Aug-13 12:13
memberclwprogrammer29-Aug-13 12:13 
QuestionListviewitem backcolor ignored... Pin
MCS_Erik14-Nov-11 0:18
memberMCS_Erik14-Nov-11 0:18 

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.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01-2016 | 2.8.180712.1 | Last Updated 27 Oct 2013
Article Copyright 2009 by clwprogrammer
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid