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 thoughts on “SDF Sample: Custom drawing a List (and viewing all network adapters too!)”

  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.

    Like

  2. Hi;
    How can i use ListBox2 i cant understand. Is there any document for this ?
    I take ListBox2 control from toolbox but i see just a white page ?!

    Like

    1. 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.

      Like

  3. Hello,

    is it possible to provide a new link for sample cause current provided link doesn’t work? 🙂 And You did great work with this all opennetcf sugars.

    Thanks

    Like

  4. Your example works pretty well, but (gasp!) i’m not able to visualize the last element correctly.
    When its size is greater than blank space size on the bottom of the list, the scrollbar won’t go down.

    Any help appreciate. You’ll save a life! 😀

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s