Example #1
0
        /// <summary>
        /// Creates the scale bar layout component.
        /// </summary>
        /// <param name="mapControl">The map control it operates on</param>
        public ScaleBarTool()
        {
            Name = "ScaleBar";
            bar = new ScaleBar
                      {
                          BarUnit = MapUnits.ws_muMeter,
                          MapUnit = MapUnits.ws_muMeter,
                          AlignMent = StringAlignment.Near
                      };

            //bar.BorderVisible = true;
            //this.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;           
        }
Example #2
0
        /// <summary>
        /// Creates the scale bar layout component.
        /// </summary>
        /// <param name="mapControl">The map control it operates on</param>
        public ScaleBarTool(MapControl mapControl) : base(mapControl)
        {
            Name = "ScaleBar";
            bar  = new ScaleBar
            {
                BarUnit   = MapUnits.ws_muKilometer,
                MapUnit   = MapUnits.ws_muKilometer,
                AlignMent = StringAlignment.Near
            };

            //bar.BorderVisible = true;
            //this.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
        }
Example #3
0
        public void ShowScaleBar()
        {
            var rectangle = new Rectangle(5,5,300,50);
            var bar = new ScaleBar();
            bar.BorderVisible = false;
            bar.TransparentBackground = true;
            bar.BorderVisible = true;

            //bar.BarColor2 = Color.Yellow;
            bar.SetScale(20, 40);
        //    bar.MapUnit = MapUnits.ws_muMeter;
          //  bar.BarUnit = MapUnits.ws_muMeter;
            //bar.SetCustomUnit(4,"test","test");
           // bar.MapUnit = MapUnits.ws_muCustom;

            using (var control = new UserControl())
            {

                
                
                control.Paint +=
                    delegate(object sender, PaintEventArgs e)
                        {
                        //    rectangle = new Rectangle(new Point(0, 0), ((Control) sender).Size);
                            bar.DrawTheControl(e.Graphics, rectangle);
                        };
                WindowsFormsTestHelper.ShowModal(control);
            }
        }