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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. How to change DataGrid Column's Header's Heigth?

How to change DataGrid Column's Header's Heigth?

Scheduled Pinned Locked Moved C#
questioncsharphelptutorial
5 Posts 2 Posters 2 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.
  • T Offline
    T Offline
    thaibinhla
    wrote on last edited by
    #1

    Dear everybody I am programming with DataGrid control in C#. The problem is that when my column header text is too long. How can I make this text wrapped into another line? The same problem with the column header but in the case I want the text showed vertically. Thank you very much Nguyen Thai Binh

    T 1 Reply Last reply
    0
    • T thaibinhla

      Dear everybody I am programming with DataGrid control in C#. The problem is that when my column header text is too long. How can I make this text wrapped into another line? The same problem with the column header but in the case I want the text showed vertically. Thank you very much Nguyen Thai Binh

      T Offline
      T Offline
      Trivikram Dwivedi
      wrote on last edited by
      #2

      try it by increasing header font size.

      T 1 Reply Last reply
      0
      • T Trivikram Dwivedi

        try it by increasing header font size.

        T Offline
        T Offline
        thaibinhla
        wrote on last edited by
        #3

        Font's size doesn't affect anything. When the text is too long, it is just hidden by other columns. And if you want to show the text vertically, you have no way???

        T 1 Reply Last reply
        0
        • T thaibinhla

          Font's size doesn't affect anything. When the text is too long, it is just hidden by other columns. And if you want to show the text vertically, you have no way???

          T Offline
          T Offline
          Trivikram Dwivedi
          wrote on last edited by
          #4

          for increasing the column header we can use this code but i could not find to wrap it. DataGridTableStyle dgTbStyle = new DataGridTableStyle(); dgTbStyle.MappingName = tb.ToString(); dataGrid1.TableStyles.Add(dgTbStyle); dataGrid1.TableStyles[0].GridColumnStyles[0].Width = 100; dataGrid1.TableStyles[0].GridColumnStyles[1].Width = 150;

          T 1 Reply Last reply
          0
          • T Trivikram Dwivedi

            for increasing the column header we can use this code but i could not find to wrap it. DataGridTableStyle dgTbStyle = new DataGridTableStyle(); dgTbStyle.MappingName = tb.ToString(); dataGrid1.TableStyles.Add(dgTbStyle); dataGrid1.TableStyles[0].GridColumnStyles[0].Width = 100; dataGrid1.TableStyles[0].GridColumnStyles[1].Width = 150;

            T Offline
            T Offline
            thaibinhla
            wrote on last edited by
            #5

            Thank you for you timely help. It's easy to change the width of the column's header. But there is no place in DataGrid that support us to change the height. It seems that DataGridView in .Net 2005 has this features. However, I want this for my application. Can you give me the answer?

            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