Skip to main content

Set cell forecolor while highlighting & cell font

Comments

3 comments

  • Dapfor Team

    Hi,
    1. We didn’t include foreground color manipulations for a single reason: to simplify the .NetGrid’s API, but you can handle the color in the Cell.PaintCell event:


    grid.PaintCell += delegate(object sender, PaintCellEventArgs e)
    {
    if(e.Cell.RemainingHighlightTime > TimeSpan.Zero)
    {
    e.Appearance.ForeColor = Color.Red;
    }
    };

    //Highlight a cell with yellow background color
    grid.Rows[1][0].Highlight(TimeSpan.FromSeconds(3), Color.Yellow);



    2. Typically cells require a considerable amount of memory when they store fonts. That’s why you will not find Cell.Font property. However, you can easily set the fonts you need at the time of cell rendering.


    grid.PaintCell += delegate(object sender, PaintCellEventArgs e)
    {
    if(e.Cell.Column != null && e.Cell.Row != null &&
    e.Cell.Column.VisibleIndex == 0 &&
    e.Cell.Row.VisibleIndex == 1)
    {
    e.Font = someFont;
    }
    };


    Best regards,
    The Dapfor Team

    0
  • guest

    Thanks a lot~!!

    0

Please sign in to leave a comment.

Powered by Zendesk