本文整理汇总了C#中CGContext类的典型用法代码示例。如果您正苦于以下问题:C# CGContext类的具体用法?C# CGContext怎么用?C# CGContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CGContext类属于命名空间,在下文中一共展示了CGContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawBorders
void DrawBorders(CGContext context, nfloat xMin, nfloat xMax, nfloat yMin, nfloat yMax, nfloat fWidth, nfloat fHeight)
{
if (BorderColorTop != null)
{
context.SetFillColor(BorderColorTop.CGColor);
context.FillRect(new CGRect(xMin, yMin, fWidth, BorderWidth.Top));
}
if (BorderColorLeft != null)
{
context.SetFillColor(BorderColorLeft.CGColor);
context.FillRect(new CGRect(xMin, yMin, BorderWidth.Left, fHeight));
}
if (BorderColorRight != null)
{
context.SetFillColor(BorderColorRight.CGColor);
context.FillRect(new CGRect(xMax - BorderWidth.Right, yMin, BorderWidth.Right, fHeight));
}
if (BorderColorBottom != null)
{
context.SetFillColor(BorderColorBottom.CGColor);
context.FillRect(new CGRect(xMin, yMax - BorderWidth.Bottom, fWidth, BorderWidth.Bottom));
}
}
示例2: GraphicsContextWrapper
public GraphicsContextWrapper(CGContext context, float boundsWidth, float boundsHeight, BasicRectangle dirtyRect)
{
Context = context;
BoundsWidth = boundsWidth;
BoundsHeight = boundsHeight;
DirtyRect = dirtyRect;
}
示例3: CreateShape
public override void CreateShape(CGPath path, CGContext gctx)
{
path.AddRect (new RectangleF (_origin, new SizeF (100, 100)));
gctx.AddPath (path);
gctx.DrawPath (CGPathDrawingMode.FillStroke);
}
示例4: Draw
public override void Draw(CGRect bounds, CGContext context, UIView view)
{
var width = 0.5f / UIScreen.MainScreen.Scale;
context.BeginPath();
context.SetLineWidth(width);
context.SetStrokeColor(UIColor.FromRGB(150, 150, 154).CGColor);
var x = bounds.Width / 2f - width;
context.MoveTo(x, 0f);
context.AddLineToPoint(x, bounds.Height);
context.StrokePath();
var row = Value;
var half = bounds.Height / 2;
var halfText = _font.LineHeight / 2 + 1;
row.Image1.Draw(new CGRect(15, half - 8f, 16f, 16f));
if (!string.IsNullOrEmpty(row.Text1))
{
UIColor.Gray.SetColor();
new NSString(row.Text1).DrawString(new CGRect(36, half - halfText, bounds.Width / 2 - 40, _font.LineHeight), _font, UILineBreakMode.TailTruncation);
}
row.Image2.Draw(new CGRect(bounds.Width / 2 + 15, half - 8f, 16f, 16f));
if (!string.IsNullOrEmpty(row.Text2))
{
UIColor.Gray.SetColor();
new NSString(row.Text2).DrawString(new CGRect(bounds.Width / 2 + 36, half - halfText, bounds.Width / 2 - 40, _font.LineHeight), _font, UILineBreakMode.TailTruncation);
}
}
示例5: Draw
public override void Draw(RectangleF bounds, CGContext context, UIView view)
{
UIColor.White.SetFill ();
context.FillRect (bounds);
context.DrawLinearGradient (
gradient,
new PointF (bounds.Left, bounds.Top),
new PointF (bounds.Left, bounds.Bottom),
CGGradientDrawingOptions.DrawsAfterEndLocation
);
UIColor.DarkGray.SetColor ();
view.DrawString (
this.Label,
new RectangleF (10, 10, bounds.Width / 2, 10),
captionFont,
UILineBreakMode.TailTruncation
);
UIColor.Black.SetColor ();
view.DrawString (
this.Number.ToString (),
new RectangleF (bounds.Width / 2, 10, (bounds.Width / 2) - 10, 10),
amountFont,
UILineBreakMode.TailTruncation,
UITextAlignment.Right
);
}
示例6: Draw
public override void Draw (RectangleF bounds, CGContext context, UIView view)
{
//UIColor.White.SetFill ();
//context.FillRect (bounds);
try
{
UIView searchView = view.ViewWithTag(1);
if (searchView == null)
{
var photoCellView = new PhotoCellView(_images, cellIndex, null);
photoCellView.Tag = 1;
view.Add(photoCellView);
}
else
{
var photoCellView = (PhotoCellView)searchView;
photoCellView.Update(_images, cellIndex);
photoCellView.DrawBorder(UIColor.Green);
}
}
catch (Exception ex)
{
Util.LogException("Draw ImagesElement", ex);
}
}
示例7: DrawInContext
public override void DrawInContext (CGContext ctx)
{
UIGraphics.PushContext (ctx);
CGRect bounds = this.Bounds;
TKFill fill = this.LabelStyle.Fill;
TKStroke stroke = new TKStroke (UIColor.Black);
TKBalloonShape shape = new TKBalloonShape (TKBalloonShapeArrowPosition.Bottom ,new CGSize(bounds.Size.Width - stroke.Width, bounds.Size.Height - stroke.Width));
CGRect textRect;
if (this.IsOutsideBounds == true) {
shape.ArrowPosition = TKBalloonShapeArrowPosition.Top;
textRect = new CGRect (bounds.Left, bounds.Top - this.LabelStyle.Insets.Top + shape.ArrowSize.Height, bounds.Size.Width, bounds.Size.Height + this.LabelStyle.Insets.Bottom);
} else {
textRect = new CGRect (bounds.Left, bounds.Top - this.LabelStyle.Insets.Top, bounds.Size.Width, bounds.Size.Height + this.LabelStyle.Insets.Bottom);
}
shape.DrawInContext (ctx, new CGPoint (bounds.GetMidX (), bounds.GetMidY ()), new TKDrawing[]{ fill, stroke });
NSMutableParagraphStyle paragraphStyle = new NSMutableParagraphStyle ();
paragraphStyle.Alignment = this.LabelStyle.TextAlignment;
NSDictionary attributes = new NSDictionary (UIStringAttributeKey.Font, UIFont.SystemFontOfSize (18),
UIStringAttributeKey.ForegroundColor, this.LabelStyle.TextColor,
UIStringAttributeKey.ParagraphStyle, paragraphStyle);
NSString text = new NSString (this.Text);
text.WeakDrawString (textRect, NSStringDrawingOptions.TruncatesLastVisibleLine | NSStringDrawingOptions.UsesLineFragmentOrigin, attributes, null);
UIGraphics.PopContext ();
}
示例8: DrawMapRect
/// <summary>
/// Draws the map rectangle.
/// </summary>
/// <param name="mapRect">Map rectangle.</param>
/// <param name="zoomScale">Zoom scale.</param>
/// <param name="context"> Graphics context.</param>
public override void DrawMapRect(MKMapRect mapRect, nfloat zoomScale, CGContext context)
{
base.DrawMapRect(mapRect, zoomScale, context);
var multiPolygons = (MultiPolygon)this.polygonOverlay;
foreach (var item in multiPolygons.Polygons)
{
var path = new CGPath();
this.InvokeOnMainThread(() =>
{
path = PolyPath(item.Polygon);
});
if (path != null)
{
context.SetFillColor(item.FillColor);
context.BeginPath();
context.AddPath(path);
context.DrawPath(CGPathDrawingMode.EOFill);
if (item.DrawOutlines)
{
context.BeginPath();
context.AddPath(path);
context.StrokePath();
}
}
}
}
示例9: Draw
public override void Draw(CGRect bounds, CGContext context, UIView view)
{
if (AutoLoadOnVisible)
{
LoadMore();
}
}
示例10: DrawInContext
public override void DrawInContext (CGContext context)
{
base.DrawInContext (context);
context.AddEllipseInRect (Bounds);
context.SetFillColor (ClockColor);
context.FillPath ();
}
示例11: DrawOutline
private static void DrawOutline(CGContext currentContext, IStyle style, CGRect destination)
{
var vectorStyle = (style as VectorStyle);
if (vectorStyle == null) return;
if (vectorStyle.Outline == null) return;
if (vectorStyle.Outline.Color == null) return;
DrawRectangle(currentContext, destination, vectorStyle.Outline.Color);
}
示例12: DrawInContext
public override void DrawInContext(CGContext ctx)
{
UIGraphics.PushContext(ctx);
Draw(Bounds);
UIGraphics.PopContext();
}
示例13: ShowCenteredTextAtPoint
protected void ShowCenteredTextAtPoint (CGContext context, float centerX, float y, string text, int textHeight)
{
context.SelectFont ("Helvetica-Bold", textHeight, CGTextEncoding.MacRoman);
context.SetTextDrawingMode (CGTextDrawingMode.Invisible);
context.ShowTextAtPoint (centerX, y, text, text.Length);
context.SetTextDrawingMode (CGTextDrawingMode.Fill);
context.ShowTextAtPoint (centerX - (context.TextPosition.X - centerX) / 2, y, text, text.Length);
}
示例14: Draw
public override void Draw(RectangleF bounds, CGContext context, UIView view)
{
UIColor.DarkGray.SetFill();
context.FillRect(bounds);
UIColor.Yellow.SetColor();
view.DrawString(_text, new RectangleF(10, 15, bounds.Width - 20, bounds.Height - 30), UIFont.BoldSystemFontOfSize(14.0f), UILineBreakMode.TailTruncation);
}
示例15: Draw
public void Draw(CGContext context)
{
if (DateTime.Now - CreatedTime < delaySpan)
return;
DrawBackground(context);
DrawLines(context);
DrawModel(context);
}