本文整理汇总了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);
}
}
}
示例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);
}
示例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);
}