当前位置: 首页>>代码示例>>C#>>正文


C# CSharpFramework.MakeValidRect方法代码示例

本文整理汇总了C#中CSharpFramework.MakeValidRect方法的典型用法代码示例。如果您正苦于以下问题:C# CSharpFramework.MakeValidRect方法的具体用法?C# CSharpFramework.MakeValidRect怎么用?C# CSharpFramework.MakeValidRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSharpFramework的用法示例。


在下文中一共展示了CSharpFramework.MakeValidRect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnPaintScene2DView

        public override void OnPaintScene2DView(CSharpFramework.Controls.Scene2DView view, PaintEventArgs e)
        {
            if (SectorVisibleMask == 0)
            return;
              if (_bViewBitmapDirty)
              {
            UpdatePreviewBitmap();
            _bViewBitmapDirty = false;
              }
              if (_2dViewBitmap != null)
              {
            BoundingBox sectorBBox = SectorExtent;
            Point p1 = view.Transform(sectorBBox.vMin);
            Point p2 = view.Transform(sectorBBox.vMax);

            Rectangle dst = view.MakeValidRect(p1, p2);
            // darker images for unloaded sectors
            _2dViewAttr.SetGamma(CurrentStatus == SectorAction.Reloaded ? 1.0f : 4.0f);
            e.Graphics.DrawImage(_2dViewBitmap, dst, 0, _2dViewBitmapResolution - 1, _2dViewBitmapResolution, -_2dViewBitmapResolution, GraphicsUnit.Pixel, _2dViewAttr); // flip vertically

            // inside selection? then overlay with color
            if (view.TouchesSelectionMarquee(sectorBBox))
              e.Graphics.FillRectangle(_selectionFill, dst);

            _pen.Color = Color.Turquoise;
            if (CurrentStatus == SectorAction.Modified) _pen.Color = Color.Orange;
            if (CurrentStatus == SectorAction.Reloaded) _pen.Color = Color.Magenta;

            dst.Location = new Point(p1.X, p2.Y);
            dst.Size = new Size(p2.X - p1.X, p1.Y - p2.Y);
            e.Graphics.DrawRectangle(_pen, dst);

            //Display terrain status
            // Locked, Modified, Unmodified

            if (_ownerTerrain.EngineTerrain.GetSectorNetworkLock(_iSectorX, _iSectorY))
            {
              dst.Width = 10;
              dst.Height = 10;
              _pen.Color = Color.Red;
              e.Graphics.DrawRectangle(_pen, dst);
            }

            if (_ownerTerrain.EngineTerrain.GetSectorOwnsLock(_iSectorX, _iSectorY))
            {
              dst.Width = 10;
              dst.Height = 10;
              _pen.Color = Color.Green;
              e.Graphics.DrawRectangle(_pen, dst);
            }
              }
              else
            base.OnPaintScene2DView(view, e);

              if (FilterCollisionCat != null && FilterCollisionCat.Enabled)
              {
            if (SectorCollisionMask > 0)
            {
              BoundingBox sectorBBox = SectorExtent;
              Point p1 = view.Transform(sectorBBox.vMin);
              Point p2 = view.Transform(sectorBBox.vMax);

              Rectangle dst = view.MakeValidRect(p1, p2);
              e.Graphics.DrawString("C", _font, Brushes.White, dst);
            }
              }
        }
开发者ID:romance-ii,项目名称:projectanarchy,代码行数:67,代码来源:TerrainVisibilityZoneShape.cs

示例2: OnPaintScene2DView

        public override void OnPaintScene2DView(CSharpFramework.Controls.Scene2DView view, System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaintScene2DView(view, e);

              BoundingBox absBox = this.AbsoluteBoundingBox;
              Point p1 = view.Transform(absBox.vMin);
              Point p2 = view.Transform(absBox.vMax);
              Rectangle rect = view.MakeValidRect(p1, p2);
              zoneBrush.Color = Color.FromArgb(120, _previewColor.R, _previewColor.G, _previewColor.B);
              zonePen.Color = Color.FromArgb(255, _previewColor.R, _previewColor.G, _previewColor.B);
              e.Graphics.FillRectangle(zoneBrush, rect);
              e.Graphics.DrawRectangle(zonePen, rect);
        }
开发者ID:romance-ii,项目名称:projectanarchy,代码行数:13,代码来源:TriggerBoxShape.cs

示例3: OnPaintScene2DView

 public override void OnPaintScene2DView(CSharpFramework.Controls.Scene2DView view, System.Windows.Forms.PaintEventArgs e)
 {
     _pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
       Point p1 = view.Transform(new Vector3F(this._selection.WorldSpaceExtent.X1, this._selection.WorldSpaceExtent.Y1, this._selection.DisplayZ));
       Point p2 = view.Transform(new Vector3F(this._selection.WorldSpaceExtent.X2, this._selection.WorldSpaceExtent.Y2, this._selection.DisplayZ));
       Rectangle r = view.MakeValidRect(p1, p2);
       e.Graphics.DrawRectangle(_pen, r);
 }
开发者ID:bgarrels,项目名称:projectanarchy,代码行数:8,代码来源:TerrainSelectionShape.cs


注:本文中的CSharpFramework.MakeValidRect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。