本文整理汇总了C#中IGraphics.DrawPolygon方法的典型用法代码示例。如果您正苦于以下问题:C# IGraphics.DrawPolygon方法的具体用法?C# IGraphics.DrawPolygon怎么用?C# IGraphics.DrawPolygon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGraphics
的用法示例。
在下文中一共展示了IGraphics.DrawPolygon方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public override void Draw(int size, int x, int y, IGraphics g, Pen pen, Brush brush)
{
int s2 = size/2;
Point[] points = new[]{new Point(x - s2, y), new Point(x, y - s2), new Point(x + s2, y), new Point(x, y + s2)};
g.FillPolygon(brush, points);
g.DrawPolygon(pen, points);
}
示例2: Draw
public override void Draw(int size, float x, float y, IGraphics g, Pen2 pen, Brush2 brush)
{
int s2 = size/2;
Point2[] points = {new Point2(x - s2, y), new Point2(x, y - s2), new Point2(x + s2, y), new Point2(x, y + s2)};
g.FillPolygon(brush, points);
g.DrawPolygon(pen, points);
}
示例3: OnRenderInternal
/// <summary>
/// Method that does the actual rendering of geometries
/// </summary>
/// <param name="map">The map</param>
/// <param name="polygon">The feature</param>
/// <param name="g">The graphics object</param>
protected override void OnRenderInternal(Map map, IPolygon polygon, IGraphics g)
{
// convert points
var pts = /*LimitValues(*/polygon.TransformToImage(map)/*)*/;
// clip
if (UseClipping)
pts = RendererHelper.ClipPolygon(pts, map.Size.Width, map.Size.Height);
// fill the polygon
if (Fill != null)
g.FillPolygon(Fill, pts);
// outline the polygon
if (Outline != null)
g.DrawPolygon(Outline, pts);
}
示例4: Render
//.........这里部分代码省略.........
Pen tp = new Pen(Color.Red, 2);
tp.DashStyle = DashStyle.DashDot;
ig.DrawLine(tp, 70,20,190,20);
tp.DashStyle = DashStyle.Dash;
ig.DrawLine(tp, 70,30,190,30);
tp.DashStyle = DashStyle.Custom;
tp.DashPattern = new float[] {1,8,2,2};
ig.DrawLine(tp, 70,40,190,40);
ig.SmoothingMode = SmoothingMode.AntiAlias;
PointF[] pts = new PointF[4];
pts[0] = new PointF(20,50);
pts[1] = new PointF(30,90);
pts[2] = new PointF(65,60);
pts[3] = new PointF(50,40);
ig.DrawLines(ow, pts);
Point[] polly = new Point[]
{
new Point(200, 40),
new Point(220, 140),
new Point(240, 100),
new Point(290, 70),
new Point(230, 10)
};
ig.DrawPolygon(tp, polly);
//arrows
Pen arr = new Pen(Color.DarkGoldenrod, 5);
AdjustableArrowCap aac = new AdjustableArrowCap(5,3, false);
arr.EndCap = LineCap.Custom;
arr.CustomEndCap = aac;
arr.StartCap = LineCap.ArrowAnchor;
ig.DrawLine(arr, 50,120, 150,200);
arr.Width = 7f;
arr.EndCap = LineCap.RoundAnchor;
arr.StartCap = LineCap.SquareAnchor;
ig.DrawLine(arr, 100,120, 200,200);
arr.Width = 9;
arr.EndCap = LineCap.DiamondAnchor;
arr.StartCap = LineCap.ArrowAnchor;
ig.DrawLine(arr, 150,120, 250,200);
Point[] al = new Point[]
{
new Point(200, 100),
new Point(300, 200),
new Point(300, 150)
};
arr.EndCap = LineCap.DiamondAnchor;
arr.StartCap = LineCap.DiamondAnchor;
ig.DrawLines(arr, al);
}
else if (s == "Curves")
示例5: DrawStartCap
protected override void DrawStartCap(IGraphics g, bool onScreen, Style style)
{
linePen.Color = style.RelationshipColor;
linePen.Width = style.RelationshipWidth;
if (association.IsAggregation)
{
g.FillPolygon(Brushes.White, diamondPoints);
g.DrawPolygon(linePen, diamondPoints);
}
else if (association.IsComposition)
{
lineBrush.Color = style.RelationshipColor;
g.FillPolygon(lineBrush, diamondPoints);
g.DrawPolygon(linePen, diamondPoints);
}
}
示例6: Render
public void Render(IGraphics g, OpenGLTextureReference tex)
{
g.SetColor (Colors.White);
var x = tex.X + tex.ShapeOffset.X;
var y = tex.Y + tex.ShapeOffset.Y;
switch (ShapeType) {
case OpenGLShapeType.Line:
g.DrawLine (x, y, x + A, y + B, C);
break;
case OpenGLShapeType.Rect:
if (Fill) {
g.FillRect (x, y, A, B);
}
else {
g.DrawRect (x, y, A, B, C);
}
break;
case OpenGLShapeType.RoundedRect:
if (Fill) {
g.FillRoundedRect (x, y, A, B, C);
}
else {
g.DrawRoundedRect (x, y, A, B, C, D);
}
break;
case OpenGLShapeType.Oval:
if (Fill) {
g.FillOval (x, y, A, B);
}
else {
g.DrawOval (x, y, A, B, C);
}
break;
case OpenGLShapeType.Character:
g.SetFont (Font);
g.DrawString (Char.ToString (), x, y);
break;
case OpenGLShapeType.Polygon: {
var dx = x - Poly.Points[0].X;
var dy = y - Poly.Points[0].Y;
var dpoly = new Polygon ();
for (var i = 0; i < Poly.Points.Count; i++) {
dpoly.AddPoint (Poly.Points[i].X + dx, Poly.Points[i].Y + dy);
}
if (Fill) {
g.FillPolygon (dpoly);
}
else {
g.DrawPolygon (dpoly, A);
}
}
break;
case OpenGLShapeType.Arc:
if (Fill) {
g.FillArc (x, y, A, B, C);
}
else {
g.DrawArc (x, y, A, B, C, D);
}
break;
case OpenGLShapeType.Polyline: {
var dx = x - PolylinePoints[0].X;
var dy = y - PolylinePoints[0].Y;
g.BeginLines (true);
for (var i = 0; i < PolylineLength - 1; i++) {
g.DrawLine (
PolylinePoints[i].X + dx,
PolylinePoints[i].Y + dy,
PolylinePoints[i + 1].X + dx,
PolylinePoints[i + 1].Y + dy,
A);
}
g.EndLines ();
}
break;
default:
throw new NotSupportedException ();
}
}
示例7: OnRender
/// <summary>
/// Function to render the actual map decoration
/// </summary>
/// <param name="g"></param>
/// <param name="map"></param>
protected override void OnRender(IGraphics g, Map map)
{
// Render the rosetta
base.OnRender(g, map);
var clip = g.ClipBounds;
var oldTransform = g.Transform;
var newTransform = new Matrix(1f, 0f, 0f, 1f, clip.Left + Size.Width*0.5f, clip.Top + Size.Height*0.5f);
g.Transform = newTransform;
var width = Size.Width;
var height = Size.Height;
var pts = new[]
{
new PointF(0f, -0.35f*height),
new PointF(0.125f*width, 0.35f*height),
new PointF(0f, 0.275f*height),
new PointF(-0.125f*width, 0.35f*height),
new PointF(0f, -0.35f*height),
};
// need to outline the needle
if (NeedleOutlineWidth>0)
{
g.DrawPolygon(new Pen(OpacityColor(NeedleOutlineColor), NeedleOutlineWidth), pts);
}
// need to outline the needle
g.FillPolygon(new SolidBrush(OpacityColor(NeedleFillColor)), pts );
g.Transform = oldTransform;
}