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#
  4. ListView and Column Margin :: C#

ListView and Column Margin :: C#

Scheduled Pinned Locked Moved C#
csharptutorialquestion
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.
  • V Offline
    V Offline
    valikac
    wrote on last edited by
    #1

    Hello, How do you set the margin (text) of a column of a ListView. For example: |Column0 | Column1| | | | I am referring simply to the text margin of a column. Given that you have to derive a class from ListView, what function do you override to set the margin or to draw the text based on a different margin? Thanks, Kuphryn

    H 1 Reply Last reply
    0
    • V valikac

      Hello, How do you set the margin (text) of a column of a ListView. For example: |Column0 | Column1| | | | I am referring simply to the text margin of a column. Given that you have to derive a class from ListView, what function do you override to set the margin or to draw the text based on a different margin? Thanks, Kuphryn

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      You must override WndProc and handle Windows messages for the header control (which are passed to their parent control's window, which is the List-View common control, which ListView encapsulates). You could handle the NM_CUSTOMDRAW message (sent using a WM_NOTIFY message, actually) and draw your text that way, perhaps extending the ListView control to provide a margin property of some sort (or just hard-code it, depending on what you need the control for).

      Microsoft MVP, Visual C# My Articles

      V 1 Reply Last reply
      0
      • H Heath Stewart

        You must override WndProc and handle Windows messages for the header control (which are passed to their parent control's window, which is the List-View common control, which ListView encapsulates). You could handle the NM_CUSTOMDRAW message (sent using a WM_NOTIFY message, actually) and draw your text that way, perhaps extending the ListView control to provide a margin property of some sort (or just hard-code it, depending on what you need the control for).

        Microsoft MVP, Visual C# My Articles

        V Offline
        V Offline
        valikac
        wrote on last edited by
        #3

        Okay. Thanks. Kuphryn

        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