Пример #1
0
 internal void RenderPanel(MapGraphics g)
 {
     if (!IsVisible())
     {
         return;
     }
     try
     {
         RectangleF relativeRectangle = g.GetRelativeRectangle(Margins.AdjustRectangle(GetBoundsInPixels()));
         g.CreateDrawRegion(relativeRectangle);
         SizeF absoluteSize = g.GetAbsoluteSize(new SizeF(100f, 100f));
         if (absoluteSize.Width < 1f || absoluteSize.Height < 1f)
         {
             return;
         }
         if (ShouldRenderBackground() && GetMapCore().RenderingMode != RenderingMode.ZoomThumb)
         {
             RenderBackground(g);
             RenderBorder(g);
         }
         if (BorderWidth > 0 && ShouldRenderBackground())
         {
             try
             {
                 RectangleF absoluteRectangle = g.GetAbsoluteRectangle(new RectangleF(0f, 0f, 100f, 100f));
                 absoluteRectangle.Inflate(-BorderWidth, -BorderWidth);
                 absoluteRectangle.Width  = Math.Max(2f, absoluteRectangle.Width);
                 absoluteRectangle.Height = Math.Max(2f, absoluteRectangle.Height);
                 g.CreateDrawRegion(g.GetRelativeRectangle(absoluteRectangle));
                 Render(g);
             }
             finally
             {
                 g.RestoreDrawRegion();
             }
         }
         else
         {
             Render(g);
         }
     }
     finally
     {
         g.RestoreDrawRegion();
     }
 }
Пример #2
0
 public void RenderPanel(MapGraphics g)
 {
     if (this.IsVisible())
     {
         try
         {
             RectangleF relativeRectangle = g.GetRelativeRectangle(this.Margins.AdjustRectangle(this.GetBoundsInPixels()));
             g.CreateDrawRegion(relativeRectangle);
             SizeF absoluteSize = g.GetAbsoluteSize(new SizeF(100f, 100f));
             if (!(absoluteSize.Width < 1.0) && !(absoluteSize.Height < 1.0))
             {
                 if (this.ShouldRenderBackground() && this.GetMapCore().RenderingMode != RenderingMode.ZoomThumb)
                 {
                     this.RenderBackground(g);
                     this.RenderBorder(g);
                 }
                 if (this.BorderWidth > 0 && this.ShouldRenderBackground())
                 {
                     try
                     {
                         RectangleF absoluteRectangle = g.GetAbsoluteRectangle(new RectangleF(0f, 0f, 100f, 100f));
                         absoluteRectangle.Inflate((float)(-this.BorderWidth), (float)(-this.BorderWidth));
                         absoluteRectangle.Width  = Math.Max(2f, absoluteRectangle.Width);
                         absoluteRectangle.Height = Math.Max(2f, absoluteRectangle.Height);
                         g.CreateDrawRegion(g.GetRelativeRectangle(absoluteRectangle));
                         this.Render(g);
                     }
                     finally
                     {
                         g.RestoreDrawRegion();
                     }
                 }
                 else
                 {
                     this.Render(g);
                 }
             }
         }
         finally
         {
             g.RestoreDrawRegion();
         }
     }
 }