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


C# CGContext.SetShadowWithColor方法代码示例

本文整理汇总了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();
		}
开发者ID:robertgreen,项目名称:monotouch-samples,代码行数:26,代码来源:AppDelegate.cs

示例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;
		}
开发者ID:vknair74,项目名称:MonoMobile.Views,代码行数:13,代码来源:UITableViewElementCell.cs

示例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 ();
        }
开发者ID:Alxandr,项目名称:CustomBadge,代码行数:12,代码来源:CustomBadgeView.cs

示例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
                                    );
                }
            }
        }
开发者ID:sergii-tkachenko,项目名称:Gistacular,代码行数:73,代码来源:NameTimeStringElement.cs


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