Page 1 of 1

Cell Font and Colour

PostPosted: Wed Mar 20, 2019 10:24 am
by SBarnes
Is there a way to set the font and the colour of the font for a particular cell in the Jiwa Grid?

Re: Cell Font and Colour  Topic is solved

PostPosted: Wed Mar 20, 2019 10:28 am
by Scott.Pearce
Code: Select all
grdLines.ActiveSheet.Cells[Row, grdLines.ActiveSheet.GetColumnFromTag(null, "QuantityDemand").Index].BackColor = Color.Red;
grdLines.ActiveSheet.Cells[Row, grdLines.ActiveSheet.GetColumnFromTag(null, "QuantityDemand").Index].ForeColor = JiwaFinancials.Jiwa.JiwaApplication.Manager.ContrastColour(System.Drawing.Color.Red);
grdLines.ActiveSheet.Cells[Row, grdLines.ActiveSheet.GetColumnFromTag(null, "QuantityDemand").Index].Font = new System.Drawing.Font(grdLines.Font.FontFamily.Name, SalesOrderForm.grdLines.Font.Size, FontStyle.Bold);

Re: Cell Font and Colour

PostPosted: Wed Mar 20, 2019 10:30 am
by SBarnes
Thank Scott, is that new record for turn around time on a post :o

Re: Cell Font and Colour

PostPosted: Wed Mar 20, 2019 10:33 am
by Scott.Pearce
*thumbs up*

Re: Cell Font and Colour

PostPosted: Wed Mar 20, 2019 10:33 am
by Mike.Sheen
Note you may need to set the LockBackColor property of the cell to null before setting the BackColor will work - if that's something you want to do.

Re: Cell Font and Colour

PostPosted: Wed Mar 20, 2019 10:35 am
by Mike.Sheen
SBarnes wrote:Thank Scott, is that new record for turn around time on a post :o


Equal record? viewtopic.php?f=26&t=955&p=3541#p3541

Re: Cell Font and Colour

PostPosted: Mon Mar 25, 2019 1:58 pm
by SBarnes
Aw shucks now I feel important ;)

Re: Cell Font and Colour

PostPosted: Tue Mar 26, 2019 12:04 pm
by SBarnes
Actually the code to make this happens looks like


Code: Select all
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyLabel").Index].Locked = false;

            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyLabel").Index].BackColor = Color.Red;
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyLabel").Index].ForeColor = Color.Red;
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyLabel").Index].Font = new System.Drawing.Font(jgPriceAndQty.Font.FontFamily.Name, jgPriceAndQty.Font.Size, FontStyle.Bold);
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyLabel").Index].Locked = true;
            
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyVal").Index].Locked = false;
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyVal").Index].BackColor = Color.Red;
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyVal").Index].ForeColor = Color.Red;
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyVal").Index].Font = new System.Drawing.Font(jgPriceAndQty.Font.FontFamily.Name, jgPriceAndQty.Font.Size, FontStyle.Bold);
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyVal").Index].Locked = true;