Home Forums WinForms controls Xceed Grid for WinForms Displaying the END of a partial cell value instead of beginning

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #16364 |

    Hi,

    I have a cell that’s using a ComboBox CellViewerManager and since i have limited space for that cell, the text in always truncated in there.  What i wanna do is to cut the beginning of the text instead of the end because the significative part is at the end.

    Here’s an example :

    2 possible values in the ComboBox :

    DP000000000123

    DP000000000456

    Right now, it displays for both : DP0000000…  I would like to see 00000123  and/or 00000456 instead.

    I make it react correctly when i activate the control by setting it’s TextBoxArea.TextAlign property to “Right”.  But it will go back to showing the beginning of the text when i leave the cell.  I could toy around with the cell value, but that causes me to micro-manage a whole bunch of things and i’d like to avoid that.

    Hopefully it is clear enough… if not, i’ll try to give more details!

     Thanks

     JP

    Imported from legacy forums. Posted by JP Lambert (had 712 views)

    User (Old forums)
    Member
    Post count: 23064

    The only alternative we can think of is to set the CellViewerManager to the ComboBox, so that the TextAlign property will also operate when the cell is not in edition.

    private void Form1_Load( object sender, EventArgs e )

    {

        WinComboBox comboBox = new WinComboBox( EnhancedBorderStyle.None );

        comboBox.TextBoxArea.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;

        comboBox.Items.Add( “DP000000000123” );

        comboBox.Items.Add( “DP000000000456” );

        ComboBoxEditor comEditor = new ComboBoxEditor( comboBox );

        ComboBoxViewer comViewer = new ComboBoxViewer( comboBox );

        gridControl1.Columns[ “column1” ].CellEditorManager = comEditor;

        gridControl1.Columns[ “column1” ].CellViewerManager = comViewer;

    }

    Imported from legacy forums. Posted by André (had 317 views)

    User (Old forums)
    Member
    Post count: 23064

    That worked!  Thanks a lot!

    JP

    Imported from legacy forums. Posted by JP Lambert (had 267 views)

    User (Old forums)
    Member
    Post count: 23064

    BTW, you can hide the DropDownButton in view mode by creating a Viewer different from the Editor.

    e.g.:

    private void Form1_Load( object sender, EventArgs e )

    {

        //Editor

        WinComboBox comboBox = new WinComboBox( EnhancedBorderStyle.None );

        comboBox.TextBoxArea.TextAlign = System.Windows.Forms.

    HorizontalAlignment.Right;

        comboBox.Items.Add(

    “DP000000000123” );

        comboBox.Items.Add(

    “DP000000000456” );

        ComboBoxEditor comEditor = new ComboBoxEditor( comboBox );

        gridControl1.Columns[

    “column1” ].CellEditorManager = comEditor;

        //Viewer

        WinComboBox comboBox1 = new WinComboBox( EnhancedBorderStyle.None );

        comboBox1.TextBoxArea.TextAlign = System.Windows.Forms.

    HorizontalAlignment.Right;

        comboBox1.DropDownButton.Visible =

    false;

        comboBox1.Items.Add(

    “DP000000000123” );

        comboBox1.Items.Add(

    “DP000000000456” );

        ComboBoxViewer comViewer = new ComboBoxViewer( comboBox1 );

        gridControl1.Columns[

    “column1” ].CellViewerManager = comViewer;

    }

    You can do the same if your ComboBox’ are bound.

     

    Imported from legacy forums. Posted by André (had 759 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.