Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Fun with List Controls

Fun with List Controls

Scheduled Pinned Locked Moved C / C++ / MFC
databasecsscomgraphicshelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    billb2112
    wrote on last edited by
    #1

    I have a derived CListCtrl in which I do a bit of custom drawing. The custom drawing had to be done because the first line of each "query" is more or less a header line. For example, if I have the programming staff's hours worked this week in a database, the first line (and subsequently, the first column) in the list control (report view of course) is the person's name. However, the real data on the next line is a date. So what's happening is that since the column is sized to handle a date, a person with a normal name has their name clipped. I'm looking for a way when I get this "status line" that I can handle the painting and not have the name clipped but have it paint the line of text over multiple columns. I've seen the examples for painting the list control when there's no items, but this isn't going to work in my situation because they're painting the entire list control which I don't want. Any help is appreciated. Bill http://www.ratebeer.com

    T 1 Reply Last reply
    0
    • B billb2112

      I have a derived CListCtrl in which I do a bit of custom drawing. The custom drawing had to be done because the first line of each "query" is more or less a header line. For example, if I have the programming staff's hours worked this week in a database, the first line (and subsequently, the first column) in the list control (report view of course) is the person's name. However, the real data on the next line is a date. So what's happening is that since the column is sized to handle a date, a person with a normal name has their name clipped. I'm looking for a way when I get this "status line" that I can handle the painting and not have the name clipped but have it paint the line of text over multiple columns. I've seen the examples for painting the list control when there's no items, but this isn't going to work in my situation because they're painting the entire list control which I don't want. Any help is appreciated. Bill http://www.ratebeer.com

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      Basically, you have two choices. Owner-draw list control delegates all drawing to your code. You're responsible for everything and have full control. OTOH, the custom-draw is usable when you just want to alter some aspects of drawing, like text color or font. I'm not sure if you'll be able to draw unbounded by columns. There should be some articles on custom-draw list control on CP. Maybe you should just use a grid - there's one right here on CodeProject. It supports multiple fonts, colors, etc. Tomasz Sowinski -- http://www.shooltz.com

      B 1 Reply Last reply
      0
      • T Tomasz Sowinski

        Basically, you have two choices. Owner-draw list control delegates all drawing to your code. You're responsible for everything and have full control. OTOH, the custom-draw is usable when you just want to alter some aspects of drawing, like text color or font. I'm not sure if you'll be able to draw unbounded by columns. There should be some articles on custom-draw list control on CP. Maybe you should just use a grid - there's one right here on CodeProject. It supports multiple fonts, colors, etc. Tomasz Sowinski -- http://www.shooltz.com

        B Offline
        B Offline
        billb2112
        wrote on last edited by
        #3

        I'm currently using custom draw to highlight particular rows. I couldn't figure out how to intercept the text drawing. I also noticed that when I looked at the rect struct that's passed into the custom draw function that top was set, but bottom, right and left were out in left field (uninitialized I'm guessing). I really don't require any additional functionality other than this, so I'm not sure if the supergrid is something I want to add at this point, but who knows, maybe I'll end up going down that route. Thanks for the feedback. Bill http://www.ratebeer.com

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups