/// <summary> /// Indicates whether the specified rectangles are equal. /// </summary> /// <param name="rect1"> The first rectangle to compare.</param> /// <param name="rect2">The second rectangle to compare.</param> /// <returns>true if the rectangles have the same location and size; otherwise, false.</returns> public static bool Equals(GcRect rect1, GcRect rect2) { if (rect1.IsEmpty) { return(rect2.IsEmpty); } return(((((double)rect1.X).Equals(rect2.X) && ((double)rect1.Y).Equals(rect2.Y)) && ((double)rect1.Width).Equals(rect2.Width)) && ((double)rect1.Height).Equals(rect2.Height)); }
/// <summary> /// Indicates whether the specified rectangle is equal to the current rectangle. /// </summary> /// <param name="o"> The object to compare to the current rectangle..</param> /// <returns>true if the rectangles have the same location and size; otherwise, false.</returns> public override bool Equals(object o) { if ((o == null) || !(o is GcRect)) { return(false); } GcRect rect = (GcRect)o; return(Equals(this, rect)); }
static GcRect() { GcRect rect = new GcRect { _x = double.PositiveInfinity, _y = double.PositiveInfinity, _width = double.NegativeInfinity, _height = double.NegativeInfinity }; s_empty = rect; }
public bool GetSelectionList(short sheet, List <GcRect> selectionList, ref GcPoint activeCell, ref PaneType paneIndex) { IExcelWorksheet worksheet = this._workbook.Worksheets[sheet]; int frozenRowCount = worksheet.FrozenRowCount; int frozenColumnCount = worksheet.FrozenColumnCount; activeCell.X = worksheet.ActiveColumnIndex; activeCell.Y = worksheet.ActiveRowIndex; ExcelWorksheet.ExcelViewportInfo defaultViewport = worksheet.DefaultViewport; if (defaultViewport != null) { int rowPaneCount = defaultViewport.RowPaneCount; int columnPaneCount = defaultViewport.ColumnPaneCount; if ((paneIndex != PaneType.TopLeft) && ((rowPaneCount > 2) || (columnPaneCount > 2))) { return(false); } if (paneIndex == PaneType.BottomRight) { if (((rowPaneCount <= 1) || (columnPaneCount <= 1)) && ((frozenRowCount <= 0) || (frozenColumnCount <= 0))) { return(false); } } else if (paneIndex == PaneType.TopRight) { if ((columnPaneCount <= 1) && (frozenColumnCount <= 0)) { return(false); } } else if (paneIndex == PaneType.BottomLeft) { if ((rowPaneCount <= 1) && (frozenRowCount <= 0)) { return(false); } } else { int num1 = (int)paneIndex; } if (selectionList != null) { if ((worksheet.Selections != null) && (worksheet.Selections.Count > 0)) { foreach (ISelectionRange range in worksheet.Selections) { if (range.activePaneType == paneIndex) { GcRect rect = new GcRect((range.Column > 0) ? ((double)range.Column) : ((double)0), (range.Row > 0) ? ((double)range.Row) : ((double)0), (range.ColumnSpan > 0) ? ((double)range.ColumnSpan) : ((double)0x4000), (range.RowSpan > 0) ? ((double)range.RowSpan) : ((double)0x100000)); selectionList.Add(rect); } } } else { selectionList.Add(new GcRect(activeCell.X, activeCell.Y, 1.0, 1.0)); } } } return(true); }
/// <summary> /// Indicates whether the specified rectangle is equal to the current rectangle. /// </summary> /// <param name="value"> The rectangle to compare to the current rectangle.</param> /// <returns>true if the rectangles have the same location and size; otherwise, false.</returns> public bool Equals(GcRect value) { return(Equals(this, value)); }