NativeExcel2 for .Net Developer's Reference

ILineFormat.BackColor Property

Gets or sets an IColorFormat interface that represents the background color for the specified line.

[Visual Basic]
PropertyBackColorAsIColorFormat
[C#]
IColorFormatBackColor{get;set;}
[C++]
__propertyIColorFormat*get_BackColor();
__propertyvoidset_BackColor(IColorFormat*);
[JScript]
functiongetBackColor():IColorFormat
functionsetBackColor(IColorFormat);

Property Value

IColorFormat interface.

Example

This example changes the color of the comment border on cell B2 to red

[C#]
IComment comment = book.Worksheets[1].Range["B2"].Comment;
if (comment != null) {
   ILineFormat line = comment.Shape.Line;
   line.Style     = MsoLineStyle.msoLineSingle;
   line.DashStyle = MsoLineDashStyle.msoLineDash;
   line.Weight    = 4;
   line.Visible   = true;
   line.ForeColor.RGB = Color.FromArgb(0x0000FF);
   line.BackColor.RGB = Color.FromArgb(0x000030);
}
[VisualBasic]
Dim comment As IComment = book.Worksheets(1).Range("B2").Comment
If Not comment Is Nothing Then
   Dim line As ILineFormat = comment.Shape.Line
   line.Style     = MsoLineStyle.msoLineSingle
   line.DashStyle = MsoLineDashStyle.msoLineDash
   line.Weight    = 4
   line.Visible   = True
   line.ForeColor.RGB = Color.FromArgb(&H0000FF)
   line.BackColor.RGB = Color.FromArgb(&H000030)
End If
[C++]
IComment* comment = book->Worksheets->Item[1]->Range->Item[S"B2"]->Comment;
if (comment != null) {
   ILineFormat* line = comment->Shape->Line;
   line->Style     = MsoLineStyle::msoLineSingle;
   line->DashStyle = MsoLineDashStyle::msoLineDash;
   line->Weight    = 4;
   line->Visible   = true;
   line->ForeColor.RGB = Color::FromArgb(0x0000FF);
   line->BackColor.RGB = Color::FromArgb(0x000030);
}

See Also

ILineFormat Interface | NativeExcel Namespace | IColorFormat interface | ForeColor property