locked
Set ListView Height and Styles RRS feed

  • Question

  • hi,
    It seems the Listview cotrol height is NOT tall enough for photo and text.  I like to know how these challenges be solved:

    1.  I want to set height of the ListView so that I can place a reasonable size photo ( say, 60x60 or thumbnail size ) and some text 

    2. have gridline


      Photo 1      Text1
    ---------------------------
     Photo 2       Text2
    ---------------------------
      photo3       Text3


    I tried the standard one which is 16x16. This is too small to look at and I can not do anything about the height.

    is there a customize drawing for this?


    Thanks

     


    Peace is the fruit of Love
    Monday, November 2, 2009 7:33 AM

Answers

All replies

  • The height of a listview item is calculated from the height of the icon used.

    Yes you can do custom drawing in Listview, you need to do subclassing and handle the custom draw messages.

    I have an article where I describe how to do this:
    http://christian-helle.blogspot.com/2009/10/listview-custom-drawing-in-netcf.html

    You might also want to check out the ListView demo in Alex Yakhnin's UI Framework for .NETCF:
    http://code.msdn.microsoft.com/uiframework

    Monday, November 2, 2009 7:48 AM
  • hi,

    1. ) I read your valuable article on customize drawing. 

    How Do set the height  and place the photo  so it can be either left or right side?


    1.1 ) I believe imageList also wont store large images. It will make large images into standard one 16x16 0r 32x32 when you use ListView to get images from ImageList.

     Height issue:
    Even my Image is 60x60, the standard listview control will only show the standard sizes ( 16x16, 32x32)

    So,I have to use create many Bitmap dynamically to insert them into ListView. Any suggestion?



    2. UIFramework

    I took you advise to download the sample. It wont work on Vs2005. It required NetCF3.5 since all the classes have this -- using system.Ling in all the graphicext, canvass...and so on. I recreate a project and add in the DLL of MSDN.UIFramework and have compiler error msg like "byte is keyword, int is keyword and so on.


    4.  Uiframework control : ListView

    Is your Custom drawing ListView will be the same as the UIframewrok ( Except that UIframework does everything like styling and set height for you?)

    thanks










    Peace is the fruit of Love
    Monday, November 2, 2009 8:21 AM
  • My article on ListView custom drawing just describes the process of how to accomplish it. I believe Alex Yakhnin's ListView Demo using the UI Framework is closer to how the full framework does it (the listview exposes events that a parent control can subscribe to and perform the drawing separately)
    Monday, November 2, 2009 8:26 AM
  • Hi ,

    Thank you. Solved the Problem of the Height. Your suggestion is correct. I can have bigger images to display on ListView Now just like to those CSS style on web.

    Now, another thing come out,How Do I make the BORDER line of ListView not viewable or disappear?


    Thank
    Peace is the fruit of Love
    Saturday, November 7, 2009 3:14 AM