158 lines
3.6 KiB
C#
158 lines
3.6 KiB
C#
using System;
|
|
|
|
namespace CPF.ReoGrid
|
|
{
|
|
public class RangeBorderProperty
|
|
{
|
|
internal RangeBorderProperty(ReferenceRange range)
|
|
{
|
|
this.range = range;
|
|
}
|
|
|
|
private void CheckForOwnerAssociated()
|
|
{
|
|
bool flag = this.range == null;
|
|
if (flag)
|
|
{
|
|
throw new ReferenceObjectNotAssociatedException("Border property is not associated to any ranges. Border might have been deleted from range. Try get this property from range again.");
|
|
}
|
|
}
|
|
|
|
private RangePosition Position
|
|
{
|
|
get
|
|
{
|
|
return this.range.Position;
|
|
}
|
|
}
|
|
|
|
public RangeBorderStyle Left
|
|
{
|
|
get
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
return this.range.Worksheet.GetRangeBorders(this.Position, BorderPositions.Left, true).Left;
|
|
}
|
|
set
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
this.range.Worksheet.SetRangeBorders(this.Position, BorderPositions.Left, value);
|
|
}
|
|
}
|
|
|
|
public RangeBorderStyle Top
|
|
{
|
|
get
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
return this.range.Worksheet.GetRangeBorders(this.Position, BorderPositions.Top, true).Top;
|
|
}
|
|
set
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
this.range.Worksheet.SetRangeBorders(this.Position, BorderPositions.Top, value);
|
|
}
|
|
}
|
|
|
|
public RangeBorderStyle Right
|
|
{
|
|
get
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
return this.range.Worksheet.GetRangeBorders(this.Position, BorderPositions.Right, true).Right;
|
|
}
|
|
set
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
this.range.Worksheet.SetRangeBorders(this.Position, BorderPositions.Right, value);
|
|
}
|
|
}
|
|
|
|
public RangeBorderStyle Bottom
|
|
{
|
|
get
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
return this.range.Worksheet.GetRangeBorders(this.Position, BorderPositions.Bottom, true).Bottom;
|
|
}
|
|
set
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
this.range.Worksheet.SetRangeBorders(this.Position, BorderPositions.Bottom, value);
|
|
}
|
|
}
|
|
|
|
public RangeBorderStyle Inside
|
|
{
|
|
get
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
return this.range.Worksheet.GetRangeBorders(this.Position, BorderPositions.InsideAll, true).InsideHorizontal;
|
|
}
|
|
set
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
this.range.Worksheet.SetRangeBorders(this.Position, BorderPositions.InsideAll, value);
|
|
}
|
|
}
|
|
|
|
public RangeBorderStyle InsideHorizontal
|
|
{
|
|
get
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
return this.range.Worksheet.GetRangeBorders(this.Position, BorderPositions.InsideHorizontal, true).InsideHorizontal;
|
|
}
|
|
set
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
this.range.Worksheet.SetRangeBorders(this.Position, BorderPositions.InsideHorizontal, value);
|
|
}
|
|
}
|
|
|
|
public RangeBorderStyle InsideVertical
|
|
{
|
|
get
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
return this.range.Worksheet.GetRangeBorders(this.Position, BorderPositions.InsideVertical, true).InsideVertical;
|
|
}
|
|
set
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
this.range.Worksheet.SetRangeBorders(this.Position, BorderPositions.InsideVertical, value);
|
|
}
|
|
}
|
|
|
|
public RangeBorderStyle Outside
|
|
{
|
|
get
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
return this.range.Worksheet.GetRangeBorders(this.Position, BorderPositions.Outside, true).Left;
|
|
}
|
|
set
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
this.range.Worksheet.SetRangeBorders(this.Position, BorderPositions.Outside, value);
|
|
}
|
|
}
|
|
|
|
public RangeBorderStyle All
|
|
{
|
|
get
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
return this.range.Worksheet.GetRangeBorders(this.Position, BorderPositions.All, true).Left;
|
|
}
|
|
set
|
|
{
|
|
this.CheckForOwnerAssociated();
|
|
this.range.Worksheet.SetRangeBorders(this.Position, BorderPositions.All, value);
|
|
}
|
|
}
|
|
|
|
private ReferenceRange range;
|
|
}
|
|
}
|