178 lines
4.2 KiB
C#
178 lines
4.2 KiB
C#
![]() |
using System;
|
|||
|
using CPF.Drawing;
|
|||
|
|
|||
|
namespace CPF.ReoGrid
|
|||
|
{
|
|||
|
public class ColumnHeaderStyle : ReferenceStyle
|
|||
|
{
|
|||
|
internal ColumnHeaderStyle(Worksheet grid, ColumnHeader columnHeader) : base(grid)
|
|||
|
{
|
|||
|
this.columnHeader = columnHeader;
|
|||
|
}
|
|||
|
|
|||
|
public bool Bold
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
return (bool)base.Worksheet.GetRangeStyle(0, this.columnHeader.Index, -1, 1, PlainStyleFlag.FontStyleBold);
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
base.SetStyle(0, this.columnHeader.Index, -1, 1, new WorksheetRangeStyle
|
|||
|
{
|
|||
|
Flag = PlainStyleFlag.FontStyleBold,
|
|||
|
Bold = value
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public bool Italic
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
return (bool)base.Worksheet.GetRangeStyle(0, this.columnHeader.Index, -1, 1, PlainStyleFlag.FontStyleItalic);
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
base.SetStyle(0, this.columnHeader.Index, -1, 1, new WorksheetRangeStyle
|
|||
|
{
|
|||
|
Flag = PlainStyleFlag.FontStyleItalic,
|
|||
|
Italic = value
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public bool Strikethrough
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
return (bool)base.Worksheet.GetRangeStyle(0, this.columnHeader.Index, -1, 1, PlainStyleFlag.FontStyleStrikethrough);
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
base.SetStyle(0, this.columnHeader.Index, -1, 1, new WorksheetRangeStyle
|
|||
|
{
|
|||
|
Flag = PlainStyleFlag.FontStyleStrikethrough,
|
|||
|
Strikethrough = value
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public bool Underline
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
return (bool)base.Worksheet.GetRangeStyle(0, this.columnHeader.Index, -1, 1, PlainStyleFlag.FontStyleUnderline);
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
base.SetStyle(0, this.columnHeader.Index, -1, 1, new WorksheetRangeStyle
|
|||
|
{
|
|||
|
Flag = PlainStyleFlag.FontStyleUnderline,
|
|||
|
Underline = value
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public ReoGridHorAlign HorizontalAlign
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
return (ReoGridHorAlign)base.Worksheet.GetRangeStyle(0, this.columnHeader.Index, -1, 1, PlainStyleFlag.HorizontalAlign);
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
base.SetStyle(0, this.columnHeader.Index, -1, 1, new WorksheetRangeStyle
|
|||
|
{
|
|||
|
Flag = PlainStyleFlag.HorizontalAlign,
|
|||
|
HAlign = value
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public ReoGridVerAlign VerticalAlign
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
return (ReoGridVerAlign)base.Worksheet.GetRangeStyle(0, this.columnHeader.Index, -1, 1, PlainStyleFlag.VerticalAlign);
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
base.SetStyle(0, this.columnHeader.Index, -1, 1, new WorksheetRangeStyle
|
|||
|
{
|
|||
|
Flag = PlainStyleFlag.VerticalAlign,
|
|||
|
VAlign = value
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public PaddingValue Padding
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
return (PaddingValue)base.Worksheet.GetRangeStyle(0, this.columnHeader.Index, -1, 1, PlainStyleFlag.Padding);
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
base.SetStyle(0, this.columnHeader.Index, -1, 1, new WorksheetRangeStyle
|
|||
|
{
|
|||
|
Flag = PlainStyleFlag.Padding,
|
|||
|
Padding = value
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public Color BackColor
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
return (Color)base.Worksheet.GetRangeStyle(0, this.columnHeader.Index, -1, 1, PlainStyleFlag.BackColor);
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
base.SetStyle(0, this.columnHeader.Index, -1, 1, new WorksheetRangeStyle
|
|||
|
{
|
|||
|
Flag = PlainStyleFlag.BackColor,
|
|||
|
BackColor = value
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public Color TextColor
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
return (Color)base.Worksheet.GetRangeStyle(0, this.columnHeader.Index, -1, 1, PlainStyleFlag.TextColor);
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
this.CheckForReferenceOwner(this.columnHeader);
|
|||
|
base.SetStyle(0, this.columnHeader.Index, -1, 1, new WorksheetRangeStyle
|
|||
|
{
|
|||
|
Flag = PlainStyleFlag.TextColor,
|
|||
|
TextColor = value
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private ColumnHeader columnHeader;
|
|||
|
}
|
|||
|
}
|