protected internal override void OnMouseMoved(BasicMouseEventArgs e) { if (xpos == null || ypos == null) { return; } int indX = GetSeparatorInd(xpos, e.X); int indY = GetSeparatorInd(ypos, e.Y); if (indX >= 0) { indY = -1; } if (indX >= 0 || indY >= 0) { Cursor = indX >= 0 ? Cursors.VSplit : Cursors.HSplit; currentComponentX = -1; currentComponentY = -1; } else { ResetCursor(); currentComponentX = GetCurrentComponentInd(xpos, e.X); currentComponentY = GetCurrentComponentInd(ypos, e.Y); Tuple <int, int> key = new Tuple <int, int>(currentComponentY, currentComponentX); if (components.ContainsKey(key)) { BasicView v = components[key]; v.OnMouseMoved(new BasicMouseEventArgs(e, xpos[currentComponentX], ypos[currentComponentY], widths[currentComponentX], heights[currentComponentY])); } } }
protected internal override void OnMouseIsDown(BasicMouseEventArgs e) { int indX1 = GetSeparatorInd(xpos, e.X); int indY1 = GetSeparatorInd(ypos, e.Y); if (indX1 >= 0) { indY1 = -1; } if (indX1 >= 0 || indY1 >= 0) { dragging = true; dragX = indX1 >= 0; dragIndex = indX1 >= 0 ? indX1 : indY1; return; } int indX; int indY; BasicView v = GetComponentAt(e.X, e.Y, out indX, out indY); if (v != null) { v.OnMouseIsDown(new BasicMouseEventArgs(e, xpos[indX], ypos[indY], widths[indX], heights[indY])); mouseDownX = indX; mouseDownY = indY; } }
protected internal override void OnMouseLeave(EventArgs e) { Tuple <int, int> key = new Tuple <int, int>(currentComponentY, currentComponentX); if (components.ContainsKey(key)) { BasicView v = components[key]; v.OnMouseLeave(e); } }
protected internal override void OnMouseWheel(BasicMouseEventArgs e) { int indX; int indY; BasicView v = GetComponentAt(e.X, e.Y, out indX, out indY); if (v != null) { v.OnMouseWheel(new BasicMouseEventArgs(e, xpos[indX], ypos[indY], widths[indX], heights[indY])); } }
protected internal override void OnMouseIsUp(BasicMouseEventArgs e) { if (dragging) { dragging = false; return; } BasicView v = GetComponentAt(mouseDownX, mouseDownY); if (v != null) { v.OnMouseIsUp(new BasicMouseEventArgs(e, xpos[mouseDownX], ypos[mouseDownY], widths[mouseDownX], heights[mouseDownY])); } }
protected internal override void OnMouseDragged(BasicMouseEventArgs e) { if (dragging) { } BasicView v = GetComponentAt(mouseDownX, mouseDownY); if (v != null) { v.OnMouseDragged(new BasicMouseEventArgs(e, xpos[mouseDownX], ypos[mouseDownY], widths[mouseDownX], heights[mouseDownY])); } //TODO: splitter }
protected internal override void OnResize(EventArgs e, int width, int height) { widths = null; heights = null; xpos = null; ypos = null; InitSizes(width, height); for (int row = 0; row < RowCount; row++) { for (int col = 0; col < ColumnCount; col++) { Tuple <int, int> key = new Tuple <int, int>(row, col); if (components.ContainsKey(key)) { BasicView v = components[key]; v.OnResize(e, widths[col], heights[row]); } } } }
protected internal override void OnPaintBackground(IGraphics g, int width, int height) { if (widths == null) { InitSizes(width, height); } for (int row = 0; row < RowCount; row++) { for (int col = 0; col < ColumnCount; col++) { Tuple <int, int> key = new Tuple <int, int>(row, col); if (components.ContainsKey(key)) { BasicView v = components[key]; g.TranslateTransform(xpos[col], ypos[row]); v.OnPaintBackground(g, widths[col], heights[row]); g.ResetTransform(); } } } }
private void InitializeComponent2() { tableLayoutPanel1 = new BasicTableLayoutView(); tableLayoutPanel2 = new BasicTableLayoutView(); mainView = new ScrollableControlMainView(this); rowHeaderView = new ScrollableControlRowHeaderView(this); rowFooterView = new ScrollableControlRowFooterView(this); rowSpacerView = new ScrollableControlRowSpacerView(this); columnHeaderView = new ScrollableControlColumnHeaderView(this); columnFooterView = new ScrollableControlColumnFooterView(this); columnSpacerView = new ScrollableControlColumnSpacerView(this); horizontalScrollBarView = new HorizontalScrollBarView(this); verticalScrollBarView = new VerticalScrollBarView(this); cornerView = new ScrollableControlCornerView(this); middleCornerView = new ScrollableControlMiddleCornerView(this); smallCornerView = new ScrollableControlSmallCornerView(); SuspendLayout(); tableLayoutPanel1.ColumnStyles.Add(new BasicColumnStyle(BasicSizeType.Percent, 100F)); tableLayoutPanel1.ColumnStyles.Add(new BasicColumnStyle(BasicSizeType.Absolute, scrollBarWidth)); tableLayoutPanel1.Add(tableLayoutPanel2, 0, 0); tableLayoutPanel1.Add(horizontalScrollBarView, 0, 1); tableLayoutPanel1.Add(verticalScrollBarView, 1, 0); tableLayoutPanel1.Add(smallCornerView, 1, 1); tableLayoutPanel1.RowStyles.Add(new BasicRowStyle(BasicSizeType.Percent, 100F)); tableLayoutPanel1.RowStyles.Add(new BasicRowStyle(BasicSizeType.Absolute, scrollBarWidth)); tableLayoutPanel2.ColumnStyles.Add(new BasicColumnStyle(BasicSizeType.AbsoluteResizeable, rowHeaderWidth)); tableLayoutPanel2.ColumnStyles.Add(new BasicColumnStyle(BasicSizeType.Percent, 100F)); tableLayoutPanel2.ColumnStyles.Add(new BasicColumnStyle(BasicSizeType.AbsoluteResizeable, rowFooterWidth)); tableLayoutPanel2.Add(mainView, 1, 1); tableLayoutPanel2.Add(rowHeaderView, 0, 1); tableLayoutPanel2.Add(rowFooterView, 2, 1); tableLayoutPanel2.Add(rowSpacerView, 0, 2); tableLayoutPanel2.Add(columnHeaderView, 1, 0); tableLayoutPanel2.Add(columnFooterView, 1, 2); tableLayoutPanel2.Add(columnSpacerView, 2, 0); tableLayoutPanel2.Add(cornerView, 0, 0); tableLayoutPanel2.Add(middleCornerView, 2, 2); tableLayoutPanel2.RowStyles.Add(new BasicRowStyle(BasicSizeType.AbsoluteResizeable, columnHeaderHeight)); tableLayoutPanel2.RowStyles.Add(new BasicRowStyle(BasicSizeType.Percent, 100F)); tableLayoutPanel2.RowStyles.Add(new BasicRowStyle(BasicSizeType.AbsoluteResizeable, columnFooterHeight)); AutoScaleDimensions = new SizeF(6F, 13F); AutoScaleMode = AutoScaleMode.Font; tableLayoutControl = tableLayoutPanel1.CreateControl(); Controls.Add(tableLayoutControl); Name = "ScrollableControl2"; Size = new Size(409, 390); ResumeLayout(false); }
public void Add(BasicView bv, int column, int row) { bv.Activate(this); components.Add(new Tuple<int, int>(row, column), bv); }
public void Activate(BasicView view) { invalidate = view.Invalidate; resetCursor = view.ResetCursor; setCursor = c => view.Cursor = c; }
public ScatterPlotViewer() { bottomAxis = new NumericAxisView(); leftAxis = new NumericAxisView(); topAxis = new NumericAxisView(); rightAxis = new NumericAxisView(); scatterPlotPlane = new ScatterPlotPlaneView(); spacer1 = new BasicView(); spacer2 = new BasicView(); spacer3 = new BasicView(); spacer4 = new BasicView(); spacer1.BackColor = Color.White; spacer2.BackColor = Color.White; spacer3.BackColor = Color.White; spacer4.BackColor = Color.White; tableLayoutView = new BasicTableLayoutView(); InitializeComponent(); tableLayoutView.Add(spacer1, 0, 0); tableLayoutView.Add(spacer2, 0, 2); tableLayoutView.Add(spacer3, 2, 0); tableLayoutView.Add(spacer4, 2, 2); tableLayoutView.Add(scatterPlotPlane, 1, 1); tableLayoutView.Add(bottomAxis, 1, 2); tableLayoutView.Add(leftAxis, 0, 1); tableLayoutView.Add(topAxis, 1, 0); tableLayoutView.Add(rightAxis, 2, 1); tableLayoutView.BackColor = Color.Transparent; tableLayoutView.ColumnStyles.Add(new BasicColumnStyle(BasicSizeType.Absolute, 37F)); tableLayoutView.ColumnStyles.Add(new BasicColumnStyle(BasicSizeType.Percent, 100F)); tableLayoutView.ColumnStyles.Add(new BasicColumnStyle(BasicSizeType.Absolute, 37F)); tableLayoutView.RowStyles.Add(new BasicRowStyle(BasicSizeType.Absolute, 37F)); tableLayoutView.RowStyles.Add(new BasicRowStyle(BasicSizeType.Percent, 100F)); tableLayoutView.RowStyles.Add(new BasicRowStyle(BasicSizeType.Absolute, 37F)); tableLayoutControl = tableLayoutView.CreateControl(); Controls.Add(tableLayoutControl); Controls.Add(toolStrip1); scatterPlotPlane.BackColor = Color.White; scatterPlotPlane.ForeColor = SystemColors.HotTrack; scatterPlotPlane.IndicatorColor = Color.Transparent; scatterPlotPlane.MouseMode = ScatterPlotMouseMode.Zoom; bottomAxis.Configurable = true; bottomAxis.Positioning = AxisPositioning.Bottom; bottomAxis.Reverse = false; bottomAxis.ZoomType = AxisZoomType.Zoom; leftAxis.Configurable = true; leftAxis.Positioning = AxisPositioning.Left; leftAxis.Reverse = true; leftAxis.ZoomType = AxisZoomType.Zoom; topAxis.Configurable = false; topAxis.Positioning = AxisPositioning.Top; topAxis.Reverse = false; topAxis.ZoomType = AxisZoomType.Indicate; rightAxis.Configurable = false; rightAxis.Positioning = AxisPositioning.Right; rightAxis.Reverse = true; rightAxis.ZoomType = AxisZoomType.Indicate; topAxis.OnZoomChange += UpdateZoomBottom; bottomAxis.OnZoomChange += UpdateZoomTop; rightAxis.OnZoomChange += UpdateZoomRight; leftAxis.OnZoomChange += UpdateZoomLeft; scatterPlotPlane.OnZoomChange += UpdateZoomFromMap; bottomAxis.BackColor = Color.White; bottomAxis.Font = new Font("Lucida Sans Unicode", 8F, FontStyle.Regular, GraphicsUnit.Point, 0); bottomAxis.ForeColor = Color.Black; leftAxis.BackColor = Color.White; leftAxis.Font = new Font("Lucida Sans Unicode", 8F, FontStyle.Regular, GraphicsUnit.Point, 0); leftAxis.ForeColor = Color.Black; topAxis.BackColor = Color.White; topAxis.Font = new Font("Lucida Sans Unicode", 8F, FontStyle.Regular, GraphicsUnit.Point, 0); topAxis.ForeColor = Color.Black; rightAxis.BackColor = Color.White; rightAxis.Font = new Font("Lucida Sans Unicode", 8F, FontStyle.Regular, GraphicsUnit.Point, 0); rightAxis.ForeColor = Color.Black; }
public void Add(BasicView bv, int column, int row) { bv.Activate(this); components.Add(new Tuple <int, int>(row, column), bv); }
private void InitializeComponent2() { TableLayoutPanel tableLayoutPanel1 = new TableLayoutPanel(); mainView = new SimpleScrollableControlMainView(this); horizontalScrollBar = new HorizontalScrollBarView(this); verticalScrollBar = new VerticalScrollBarView(this); smallCornerView = new ScrollableControlSmallCornerView(); tableLayoutPanel1.SuspendLayout(); SuspendLayout(); tableLayoutPanel1.ColumnCount = 2; tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, CompoundScrollableControl.scrollBarWidth)); mainControl = mainView.CreateControl(); tableLayoutPanel1.Controls.Add(mainControl, 0, 0); tableLayoutPanel1.Controls.Add(horizontalScrollBar.CreateControl(), 0, 1); tableLayoutPanel1.Controls.Add(verticalScrollBar.CreateControl(), 1, 0); tableLayoutPanel1.Controls.Add(smallCornerView.CreateControl(), 1, 1); tableLayoutPanel1.Dock = DockStyle.Fill; tableLayoutPanel1.Location = new Point(0, 0); tableLayoutPanel1.Margin = new Padding(0); tableLayoutPanel1.Name = "tableLayoutPanel1"; tableLayoutPanel1.RowCount = 2; tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, CompoundScrollableControl.scrollBarWidth)); tableLayoutPanel1.Size = new Size(409, 390); tableLayoutPanel1.TabIndex = 0; AutoScaleDimensions = new SizeF(6F, 13F); AutoScaleMode = AutoScaleMode.Font; Controls.Add(tableLayoutPanel1); Name = "ScrollableControl2"; Size = new Size(409, 390); tableLayoutPanel1.ResumeLayout(false); ResumeLayout(false); }