SDF Sample: Custom drawing a List (and viewing all network adapters too!)

Problem
I have some fairly complex data I want to put into a list.  I’d like to use different fonts, icons and maybe even some custom lines and polygons.  Unfortunately the ListBox control in the CF pretty much sucks for this type of thing.  What can the SDF do for me?

Solution
Yes, the default ListBox control is a bit challenged, but all hope is not lost.  The OpenNETCF.Windows.Forms.ListBox2 follows the desktop model and provides owner-drawn capabilities.  Here are some screen shots of a sample application we have for the ListBox2 as well as some of the OpenNETCF.Net networking classes.

   

As you can see, we’re drawing items with different font sizes, colors and weights on both screens, plus we’re adding some icons in each item in the second and I have that nice and ugly custom “selected” color.

Download the full sample (NetUI) here.

11 Comments

  1. Is there any way to draw items with different heights per item?

    Lets say, we have 4 items:
    ItemA has a height of 20
    ItemB has a height of 20
    itemC has a height of *45*
    itemD has a height of 20

    Thanks!
    Cheers, Zeno.

    • I’m not sure I have the tab control app from that blog entry – there isn’t an original download. Basically I just used the IoC framework (ioc.codeplex.com) with a couple workspaces.

Leave a Reply