public Painter(ImageMapView mapView) { this.imageMap = mapView.ImageMap; this.segmentMap = mapView.SegmentMap; this.granularity = mapView.granularity; segLayouts = new List <SegmentLayout>(); long x = 0; long cx = 0; if (imageMap != null && granularity > 0) { foreach (var segment in segmentMap.Segments.Values) { cx = (segment.Size + granularity - 1) / granularity; segLayouts.Add(new SegmentLayout { Segment = segment, X = x, CxWidth = cx }); x += cx + CxSegmentBorder; } } this.rcClient = mapView.ClientRectangle; rcBody = new Rectangle( CxScroll, 0, rcClient.Width - 2 * CxScroll, rcClient.Height - CySelection); Extent = (int)x; }
public void Setup() { ctrl = new ImageMapView(); form = new Form(); form.Controls.Add(ctrl); ctrl.Dock = DockStyle.Top; form.Show(); }
public void Paint(Graphics g, ImageMapView mapView) { this.brBack = new SolidBrush(mapView.BackColor); this.brCode = new SolidBrush(Color.Pink); this.brData = new SolidBrush(Color.LightBlue); try { RenderSelectionBar(g, mapView.Focused); RenderScrollControls(g, mapView); RenderBody(g, mapView.cxOffset); } finally { brData.Dispose(); brCode.Dispose(); brBack.Dispose(); } }
private void RenderScrollControls(Graphics g, ImageMapView mapView) { int cbTotal = 0; var baseState = imageMap != null && cbTotal > granularity * rcClient.Width ? ButtonState.Flat : ButtonState.Flat | ButtonState.Inactive; ControlPaint.DrawScrollButton(g, 0, (rcClient.Height - CyScroll) / 2, CxScroll, CyScroll, ScrollButton.Left, (mapView.scrollButton == ScrollButton.Left ? ButtonState.Pushed : ButtonState.Normal) | baseState); ControlPaint.DrawScrollButton(g, rcClient.Width - CxScroll, (rcClient.Height - CyScroll) / 2, CxScroll, CyScroll, ScrollButton.Right, (mapView.scrollButton == ScrollButton.Left ? ButtonState.Pushed : ButtonState.Normal) | baseState); }
public void TearDown() { form.Dispose(); form = null; ctrl = null; }