CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2001
    Location
    Minneapolis, MN, USA
    Posts
    150

    Wordwrap or Multiline Datagrids?

    Has anyone figured out how to give the ability to Wordwrap or Multiline a Datagrid's column? What I will probably do is set columns to different/same column width then have the ability for each column to have Wordwrap or Multiline. Thanks in advanced!!!!

  2. #2
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    only thing that i think of is use Format/FormatInfo of DataGridTextBoxColumn.
    you can always check the size of the box and wrap it manually.

    Paresh
    - Software Architect

  3. #3
    Join Date
    Aug 2001
    Location
    Minneapolis, MN, USA
    Posts
    150
    Do you have or know of any examples of the DataGridTextBoxColumn?

  4. #4
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    public class MyDataGridTextBoxColumn : DataGridTextBoxColumn
    {

    private void HandleKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
    {
    }

    /// blah blah events

    }

    and now some where in your code,

    MyDataGridTextBoxColumn aColumnTextColumn = new MyDataGridTextBoxColumn() ;

    aColumnTextColumn.HeaderText = ...
    aColumnTextColumn.MappingName = ....

    tableStyle.GridColumnStyles.Add(aColumnTextColumn);

    you can add this tableStyle to current datagrid by

    dataGridMyGrid.TableStyles.Add(tableStyle); // you can add as much styles you want and thus randomly chaning the styles at run time also.


    -Paresh
    - Software Architect

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