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. MultiLine datagrid header

MultiLine datagrid header

Scheduled Pinned Locked Moved C#
question
6 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.
  • D Offline
    D Offline
    denizmercan
    wrote on last edited by
    #1

    How can I do this. I use \n in the header. But it doesn't show the second line. thanks in advance.

    T 1 Reply Last reply
    0
    • D denizmercan

      How can I do this. I use \n in the header. But it doesn't show the second line. thanks in advance.

      T Offline
      T Offline
      Torsten Mauz
      wrote on last edited by
      #2

      You need to use html to affect the layout when rendered to the browser, so in this case you should use either
      or

      ...

      . You will probably find if you view the source of your page that it has put the newline in there but, as the browser will ignore the newline, it doesn't do you much good. HTH

      D 1 Reply Last reply
      0
      • T Torsten Mauz

        You need to use html to affect the layout when rendered to the browser, so in this case you should use either
        or

        ...

        . You will probably find if you view the source of your page that it has put the newline in there but, as the browser will ignore the newline, it doesn't do you much good. HTH

        D Offline
        D Offline
        denizmercan
        wrote on last edited by
        #3

        sorry I forgot to say, I need to do this in C# windows application.

        T 1 Reply Last reply
        0
        • D denizmercan

          sorry I forgot to say, I need to do this in C# windows application.

          T Offline
          T Offline
          Torsten Mauz
          wrote on last edited by
          #4

          Right I've managed to munge a work around for this. Perform the following steps: 1). Add a TableStyle to the table styles collection for the datagrid (I just left the defaults on for this). 2). On the actual datagrid (not the table style you just created), change the HeaderFont size property to something bigger (16 got me two lines of text). 3). Use \n to add line breaks. This should sort you out. Let me know if you can't get it working and i will post some a demo for you. HTH

          D 1 Reply Last reply
          0
          • T Torsten Mauz

            Right I've managed to munge a work around for this. Perform the following steps: 1). Add a TableStyle to the table styles collection for the datagrid (I just left the defaults on for this). 2). On the actual datagrid (not the table style you just created), change the HeaderFont size property to something bigger (16 got me two lines of text). 3). Use \n to add line breaks. This should sort you out. Let me know if you can't get it working and i will post some a demo for you. HTH

            D Offline
            D Offline
            denizmercan
            wrote on last edited by
            #5

            that works. Thanks a lot

            T 1 Reply Last reply
            0
            • D denizmercan

              that works. Thanks a lot

              T Offline
              T Offline
              Torsten Mauz
              wrote on last edited by
              #6

              No problem, but it should be noted that this is not a very nice way of fixing things. I'm sure if you made this an ownerdrawn control and handled the painting yourself, you could fix things without having to trick the control about the font-size. Although, i suppose compared to just twiddling a couple of properties it's a lot more hassle doing things properly :)

              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