Home Forums WinForms controls Xceed Grid for WinForms Icon display in WinGrid (for .Net, not WPF)

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

    I’ve been reading thru the forums for a way to display individual icons in a datagrid cell. Using the CellContentTemplate seems like overkill and does not work well if you don’t have data bound to an image in a table. For instance, if I have a column that says “Open Case” and I would like another column that has an image representing the Open Case status, I have no association in a database betwen the Open Case text and any icon in the database.

    Just like I can swap controls out dynamically for input controls like a wincombobox, wintextbox, numerictextbox, etc, is it possible to replace a cell with a custom control or a windows control such as the picturebox? If so, this would be a neat solution since there is no image property on a wingrid cell.

    Coincidentially, one limited workaround is to set a cell’s Background Image, BackgroundImageAlignment and HorizontalAlignments such that an image displays on the left of each cell and the text is centered, but this is limited to very small images no larger than the height of the cell. I’d hate to rely on this method, if possible.

    Thanks again for your help.

    Imported from legacy forums. Posted by John (had 2861 views)

    Xceed Support
    Member
    Post count: 5658

    There is already a type in the Grid to display images (or icons).

    Here is a snippet that shows how to add icons to all the cells from a column (with an image type).

    e.g.,
    <code>
    Column imageViewer = new Column( “Image”, typeof( System.Drawing.Image ) );
    imageViewer.CellViewerManager = new ImageViewer();
    gridControl1.Columns.Add( imageViewer );

    foreach( Xceed.Grid.DataRow row in gridControl1.DataRows )
    {
    row.Cells[ “Image” ].Value = new Bitmap( @”C:\Windows.old\Program Files\Microsoft Office\OFFICE11\FORMS\1033\CNFNOT.ICO” );
    }
    </code>

    Imported from legacy forums. Posted by CharlesB (had 3055 views)

    User (Old forums)
    Member
    Post count: 23064

    How would you should an image in a cell if the column is a DataBoundColumn?

    For instance, I want to show an up arrow is the value is 1 and a down arrow is the value is -1. 

    Thanks

    Mat 

    Imported from legacy forums. Posted by Mat (had 823 views)

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