public override void UpdateView() { var outlines = sheet.GetOutlines(this.Flag); if (outlines != null) { RGFloat scale = Math.Min(this.scaleFactor, 1f); int buttonSize = (int)Math.Round((Worksheet.OutlineButtonSize) * this.scaleFactor); if (buttonSize > Worksheet.OutlineButtonSize) { buttonSize = Worksheet.OutlineButtonSize; } for (int idx = 0; idx < outlines.Count; idx++) { int pos = (int)Math.Round(((3 + Worksheet.OutlineButtonSize) * idx) * scale); OutlineGroup <ReoGridOutline> line = outlines[idx]; if (idx < outlines.Count - 1) { foreach (var outline in line) { outline.ToggleButtonBounds = CreateToggleButtonRect(pos, outline.End, buttonSize); } } } } }
public override void UpdateView() { var outlines = sheet.outlines[RowOrColumn.Column]; if (outlines != null) { RGFloat scale = Math.Min(this.scaleFactor, 1f); RGFloat buttonSize = ((this.scaleFactor > 1f) ? Worksheet.OutlineButtonSize : Worksheet.OutlineButtonSize * scale); for (int idx = 0; idx < outlines.Count; idx++) { OutlineGroup <ReoGridOutline> line = outlines[idx]; RGFloat y = (3 + Worksheet.OutlineButtonSize) * idx * scale; RGFloat x = bounds.Left + (bounds.Width - buttonSize) / 2; line.NumberButtonBounds = new Rectangle(x, y + 1, buttonSize, buttonSize); } } }
public override void Draw(CellDrawingContext dc) { var g = dc.Renderer; var controlStyle = sheet.workbook.controlAdapter.ControlStyle; var outlines = sheet.outlines[Flag]; g.BeginDrawHeaderText(1f); var borderPen = dc.Renderer.GetPen(controlStyle[ControlAppearanceColors.OutlinePanelBorder]); var textBrush = dc.Renderer.GetBrush(controlStyle[ControlAppearanceColors.OutlineButtonText]); dc.Graphics.FillRectangle(bounds, controlStyle[ControlAppearanceColors.OutlinePanelBackground]); if (outlines != null) { for (int idx = 0; idx < outlines.Count; idx++) { OutlineGroup <ReoGridOutline> line = outlines[idx]; Rectangle numberRect = line.NumberButtonBounds; if (pressedIndex == idx) { numberRect.Offset(1, 1); } g.DrawRectangle(borderPen, numberRect); g.DrawHeaderText((idx + 1).ToString(), textBrush, numberRect); } } // right g.DrawLine(borderPen, bounds.Right, bounds.Top, bounds.Right, bounds.Bottom); // bottom g.DrawLine(borderPen, bounds.X, bounds.Bottom, bounds.Right, bounds.Bottom); }
public override void DrawView(CellDrawingContext dc) { var g = dc.Graphics; var controlStyle = sheet.workbook.controlAdapter.ControlStyle; #if DEBUG Stopwatch sw = Stopwatch.StartNew(); #endif var outlines = sheet.outlines[RowOrColumn.Column]; if (outlines != null) { var p = dc.Renderer.GetPen(controlStyle[ControlAppearanceColors.OutlineButtonBorder]); RGFloat scale = Math.Min(this.scaleFactor, 1f); RGFloat halfButtonSize = Worksheet.OutlineButtonSize / 2f * scale; for (int idx = 0; idx < outlines.Count; idx++) { OutlineGroup <ReoGridOutline> line = null; if (idx < outlines.Count - 1) { line = outlines[idx]; foreach (var outline in line) { var endCol = sheet.cols[outline.End]; if (!endCol.IsVisible) { continue; } if (this.scaleFactor > 0.5f) { p.Width = 2; } Rectangle bbRect = outline.ToggleButtonBounds; RGFloat crossX = bbRect.X + bbRect.Width / 2; RGFloat crossY = bbRect.Y + bbRect.Height / 2; if (outline.InternalCollapsed) { g.DrawLine(p, crossX, bbRect.Top + 3, crossX, bbRect.Bottom - 2); } else { // - var startCol = sheet.cols[outline.Start]; RGFloat x = startCol.Left * this.scaleFactor; g.DrawLine(p, x, bbRect.Bottom - 1, x, crossY); g.DrawLine(p, x - 1, crossY, bbRect.Left, crossY); } // | g.DrawLine(p, bbRect.Left + 3, crossY, bbRect.Right - 2, crossY); // frame p.Width = 1; g.DrawRectangle(p, bbRect.X, bbRect.Y, bbRect.Width, bbRect.Height); } } // draw dot var prevGroup = idx <= 0 ? null : outlines[idx - 1]; if (prevGroup != null) { int y = (int)Math.Round((3 + Worksheet.OutlineButtonSize) * idx * scale); foreach (var prevol in prevGroup) { if (!prevol.InternalCollapsed) { for (int r = prevol.Start; r < prevol.End; r++) { if (line == null || !line.Any(o => o.Start <= r && o.End >= r)) { var colHead = sheet.cols[r]; if (colHead.IsVisible) { RGFloat x = (colHead.Left + colHead.InnerWidth / 2) * this.scaleFactor; g.DrawLine(p, x - 1, y + halfButtonSize, x - 1, y + halfButtonSize + 1); g.DrawLine(p, x, y + halfButtonSize, x, y + halfButtonSize + 1); } } } } } } } } #if DEBUG sw.Stop(); long ms = sw.ElapsedMilliseconds; if (ms > 10) { Debug.WriteLine("draw column outlines takes " + ms + " ms."); } #endif }
/// <summary> /// Called when a OutlineGroup node is encountered in the document. /// </summary> public override void VisitOutlineGroupStart(OutlineGroup outlineGroup) { ++nodecount; }