CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Location
    Toulouse, France
    Posts
    8

    Palette problem in List View control (256 colors)

    I've got a list view control - report style. I have an image list attached to it, and in some columns I display small icons.
    How do I manage icons to show correctly in 256 color mode ?
    I probably need to set the icon's palette before drawing it, but I don't know how I can manage palettes in list view controls.
    Has somebody got his working ?

    --
    Axelle Apvrille - MSI

  2. #2
    Join Date
    Apr 1999
    Location
    Nottingham, UK
    Posts
    35

    Re: Palette problem in List View control (256 colors)

    You could create a median palette (a palette with a range of 256 colours) and select this and realize it before drawing your icon. You could then rely on Windows colour matching to get the closest match from your palette, this might by satisfactory, it depends what your trying to do...


  3. #3
    Join Date
    Apr 1999
    Location
    Toulouse, France
    Posts
    8

    Re: Palette problem in List View control (256 colors)

    Thanks for your answer. I've tried something like this, but result isn't really good.
    1/ For each icon, I store its palette.
    2/ On WM_PAINT,
    hdc = GetDC(list view wnd);
    I get my palette, then SelectPalette(hdc,mypalette, FALSE) (foreground palette).
    RealizePalette.
    Draw Image list using ImageList_Draw.
    I put back old palette (SelectPalette(hdc, holdpalette, TRUE) ) in background.
    return 0 to say I have managed the message.

    Am I missing something ?
    Result is not satisfactory (it's doing something but not much). When I have a look at NT's explorer, it manages to display nearly perfect icons. So, it's possible to do better. How does it achieve that ?!


    --
    Axelle Apvrille - MSI

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured