Set cell forecolor while highlighting & cell font
Hi,
1.
I use the suggested RowUpdated event to trigger cell highlight and it work. How to set the cell text forecolor while its blinking?
For example,
cell backcolor is black
cell forecolor is white
highlight color is Color.Lime (or any bright color)
I would like to set cell forecolor to black while its blinking lime color. Is there any method?
2.
How to set cell fonts? I couldn't find in properties to set it. The default is ms sans serif with 8.25 size
-
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 Team0 -
Thanks a lot~!!
0
Please sign in to leave a comment.
Comments
3 comments