internal void InvalidatePanel(FlowPanel panel, Rectangle rect) { Verify.Argument.IsNotNull(panel, nameof(panel)); Verify.Argument.IsTrue(panel.FlowControl == this, "panel", "Panel is not owned by this FlowLayoutControl."); var graphics = GraphicsUtility.MeasurementGraphics; int y = ClientArea.Y - VScrollPos; int x = ClientArea.X - HScrollPos; for (int i = 0; i < Panels.Count; ++i) { var p = Panels[i]; var size = GetPanelSize(graphics, p); int maxY = y + size.Height; if (p == panel) { if (maxY >= ClientArea.Y) { var bounds = new Rectangle(x + rect.X, y + rect.Y, rect.Width, rect.Height); var clip = Rectangle.Intersect(bounds, ClientArea); if (clip.Width > 0 && clip.Height > 0) { Invalidate(clip); } } break; } if (maxY >= ClientArea.Bottom) { break; } y = maxY; } }
protected override void OnMouseDoubleClick(MouseEventArgs e) { int x = e.X; int y = e.Y; int panelY = ClientArea.Y - VScrollPos; _mouseDownPanel = null; bool found = false; for (int i = 0; i < Panels.Count; ++i) { var panel = Panels[i]; var size = GetPanelSize(panel); int maxY = panelY + size.Height; if (maxY >= y) { _mouseDownPanel = panel; _panelHover.Track(i, panel); OnPanelDoubleClick(panel, x - ClientArea.X + HScrollPos, y - panelY, e.Button); found = true; break; } if (maxY >= ClientRectangle.Bottom) { break; } panelY = maxY; } if (!found) { OnFreeSpaceDoubleClick(x, y, e.Button); } Focus(); base.OnMouseDoubleClick(e); }
private Size GetPanelSize(Graphics graphics, FlowPanel panel, int width) { if (!_sizes.TryGetValue(panel, out var size)) { size = panel.Measure( new FlowPanelMeasureEventArgs(graphics, width)); _sizes.Add(panel, size); } return(size); }
private Size GetPanelSize(FlowPanel panel) { if (!_sizes.TryGetValue(panel, out var size)) { var graphics = GraphicsUtility.MeasurementGraphics; size = panel.Measure( new FlowPanelMeasureEventArgs(graphics, ClientArea.Width)); _sizes.Add(panel, size); } return(size); }
internal void InvalidatePanelSize(FlowPanel panel) { if (InvokeRequired) { BeginInvoke(new Action <FlowPanel>(InvalidatePanelSize), panel); } else { _sizes.Remove(panel); NotifyContentSizeChanged(); } }
private Size GetPanelSize(Graphics graphics, FlowPanel panel) { Size size; if (!_sizes.TryGetValue(panel, out size)) { size = panel.Measure( new FlowPanelMeasureEventArgs(graphics, ClientArea.Width)); _sizes.Add(panel, size); } return(size); }
protected override void OnMouseUp(MouseEventArgs e) { if (_mouseDownPanel != null) { if (_mouseDownPanel.FlowControl == this) { int x = e.X; int y = e.Y; var bounds = GetPanelBounds(_mouseDownPanel); _mouseDownPanel.MouseUp(x - ClientArea.X + HScrollPos, y - bounds.Y + VScrollPos, e.Button); } _mouseDownPanel = null; } base.OnMouseUp(e); }
internal void ScrollIntoView(FlowPanel p) { int panelY = 0; for (int i = 0; i < Panels.Count; ++i) { var panel = Panels[i]; var size = GetPanelSize(panel); int maxY = panelY + size.Height; if (p == panel) { if (panelY > MaxVScrollPos) { panelY = MaxVScrollPos; } VScrollBar.Value = panelY; break; } panelY = maxY; } }
internal Rectangle GetPanelBounds(FlowPanel panel) { Verify.Argument.IsNotNull(panel, nameof(panel)); Verify.Argument.IsTrue(panel.FlowControl == this, "panel", "Panel is not owned by this FlowLayoutControl."); var graphics = GraphicsUtility.MeasurementGraphics; int y = ClientArea.Y; for (int i = 0; i < Panels.Count; ++i) { var p = Panels[i]; var size = GetPanelSize(graphics, p); int maxY = y + size.Height; if (p == panel) { return(new Rectangle(ClientArea.X, y, size.Width, size.Height)); } y = maxY; } Assert.Fail("Panel not found."); return(Rectangle.Empty); }
protected FlowPanelHeader(FlowPanel flowPanel) { Verify.Argument.IsNotNull(flowPanel, "flowPanel"); _flowPanel = flowPanel; }
protected virtual void OnPanelDoubleClick(FlowPanel panel, int x, int y, MouseButtons button) { panel.DoubleClick(x, y, button); }
protected virtual void OnPanelMouseDown(FlowPanel panel, int x, int y, MouseButtons button) { panel.MouseDown(x, y, button); }
protected FlowPanelHeader(FlowPanel flowPanel) { Verify.Argument.IsNotNull(flowPanel, "flowPanel"); _flowPanel = flowPanel; }