Пример #1
0
            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;
            }
Пример #2
0
 public void Setup()
 {
     ctrl = new ImageMapView();
     form = new Form();
     form.Controls.Add(ctrl);
     ctrl.Dock = DockStyle.Top;
     form.Show();
 }
Пример #3
0
 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();
     }
 }
Пример #4
0
            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);
            }
Пример #5
0
 public void TearDown()
 {
     form.Dispose();
     form = null;
     ctrl = null;
 }