本文整理汇总了C#中CGContext.SetShadowWithColor方法的典型用法代码示例。如果您正苦于以下问题:C# CGContext.SetShadowWithColor方法的具体用法?C# CGContext.SetShadowWithColor怎么用?C# CGContext.SetShadowWithColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGContext
的用法示例。
在下文中一共展示了CGContext.SetShadowWithColor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawInContext
public override void DrawInContext (CGContext context)
{
base.DrawInContext (context);
// Console.WriteLine ("DrawInContext Radius: {0} Thickness: {1} Color: {2}", Radius, Thickness, Color);
PointF centerPoint = new PointF (this.Bounds.Width / 2, this.Bounds.Height / 2);
CGColor glowColor = new UIColor (Color).ColorWithAlpha (0.85f).CGColor;
double innerRadius = (Radius - Thickness) > 0 ? Radius - Thickness : 0;
// Outer circle
context.AddEllipseInRect (new RectangleF (centerPoint.X - (float) Radius,
centerPoint.Y - (float) Radius,
(float) Radius * 2,
(float) Radius * 2));
// Inner circle
context.AddEllipseInRect (new RectangleF (centerPoint.X - (float) innerRadius,
centerPoint.Y - (float) innerRadius,
(float) innerRadius * 2,
(float) innerRadius * 2));
// Fill in circle
context.SetFillColor (Color);
context.SetShadowWithColor (SizeF.Empty, 10.0f, glowColor);
context.EOFillPath();
}
示例2: DrawBorder
private void DrawBorder(CGContext context, CGPath path)
{
var separatorColor = Element.Theme.SeparatorColor ?? TableView.SeparatorColor;
context.SetLineWidth(1);
context.SetStrokeColor(separatorColor.CGColor);
context.SetShadowWithColor(new SizeF(0,0), 0f, UIColor.Clear.CGColor);
context.AddPath(path);
context.DrawPath(CGPathDrawingMode.Stroke);
return;
}
示例3: DrawRoundedRect
private void DrawRoundedRect(CGContext context, RectangleF rect)
{
context.SaveState ();
context.BeginPath ();
context.SetFillColor (badgeColor.CGColor);
MakePath (context, rect);
context.SetShadowWithColor (new SizeF (1.0f, 1.0f), 3, UIColor.Black.CGColor);
context.FillPath ();
context.RestoreState ();
}
示例4: Draw
public override void Draw(RectangleF bounds, CGContext context, UIView view)
{
var leftMargin = LeftRightPadding;
// Superview is the container, its superview the uitableviewcell
var uiTableViewCell = view.Superview.Superview as UITableViewCell;
bool highlighted = uiTableViewCell != null && uiTableViewCell.Highlighted & IsTappedAssigned;
var timeColor = highlighted ? UIColor.White : UIColor.Gray;
var textColor = highlighted ? UIColor.White : UIColor.FromRGB(41, 41, 41);
var nameColor = highlighted ? UIColor.White : UIColor.FromRGB(0, 64, 128);
if (Image != null)
{
var imageRect = new RectangleF(LeftRightPadding, TopBottomPadding, 32f, 32f);
UIColor.White.SetColor ();
context.SaveState ();
//context.TranslateCTM (imageRect.X, imageRect.Y);
context.SetLineWidth (1);
// On device, the shadow is painted in the opposite direction!
context.SetShadowWithColor (new SizeF (0, 0), 3, UIColor.DarkGray.CGColor);
context.AddPath (UIBezierPath.FromRect(imageRect).CGPath);
context.FillPath ();
context.RestoreState ();
Image.Draw(imageRect);
leftMargin += LeftRightPadding + imageRect.Width + 3f;
}
var contentWidth = bounds.Width - LeftRightPadding - leftMargin;
var daysAgo = Time.ToDaysAgo();
timeColor.SetColor();
var daysWidth = daysAgo.MonoStringLength(DateFont);
RectangleF timeRect;
timeRect = Image != null ? new RectangleF(leftMargin, TopBottomPadding + UserFont.LineHeight, daysWidth, DateFont.LineHeight) :
new RectangleF(bounds.Width - LeftRightPadding - daysWidth, TopBottomPadding + 1f, daysWidth, DateFont.LineHeight);
view.DrawString(daysAgo, timeRect, DateFont, UILineBreakMode.TailTruncation);
nameColor.SetColor();
view.DrawString(Name,
new RectangleF(leftMargin, TopBottomPadding, contentWidth, UserFont.LineHeight),
UserFont, UILineBreakMode.TailTruncation
);
if (!string.IsNullOrEmpty(String))
{
UIColor.Black.SetColor();
var top = TopBottomPadding + UserFont.LineHeight + 3f;
if (Image != null)
top += DateFont.LineHeight;
textColor.SetColor();
if (Image == null)
{
view.DrawString(String,
new RectangleF(LeftRightPadding, top, bounds.Width - LeftRightPadding * 2, bounds.Height - TopBottomPadding - top),
DescFont, UILineBreakMode.TailTruncation
);
}
else
{
view.DrawString(String,
new RectangleF(leftMargin, top, contentWidth, bounds.Height - TopBottomPadding - top),
DescFont, UILineBreakMode.TailTruncation
);
}
}
}