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


C# nfloat类代码示例

本文整理汇总了C#中nfloat的典型用法代码示例。如果您正苦于以下问题:C# nfloat类的具体用法?C# nfloat怎么用?C# nfloat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


nfloat类属于命名空间,在下文中一共展示了nfloat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddBorder

		public static void AddBorder(this UIView view, UIRectEdge edge, UIColor color, nfloat thickness) {

			var border = new CALayer ();
			var f = view.Frame;
			switch(edge)
			{
			case UIRectEdge.Top:
				border.Frame = new CGRect(0, 0, f.Width, thickness);
				break;
			case UIRectEdge.Bottom:
				border.Frame = new CGRect (0, f.Height - thickness, f.Width, thickness);
				break;
			case UIRectEdge.Left:
				border.Frame = new CGRect(0, 0, thickness, f.Height);
				break;
			case UIRectEdge.Right:
				border.Frame = new CGRect(f.Width - thickness, 0, thickness, f.Height);
				break;
			default:
				break;
			}

			border.BackgroundColor = color.CGColor;
			view.Layer.AddSublayer (border);
		}
开发者ID:ddomengeaux,项目名称:xamarin-amccorma,代码行数:25,代码来源:UIViewExtensions.cs

示例2: Draw

        public override void Draw(CGRect rect)
        {
            //Stopwatch s = new Stopwatch();
            //s.Start();

            //Console.WriteLine (" ----- SatBrightPickerView Draw");

            CGContext context = UIGraphics.GetCurrentContext ();

            CGColor[] gradColors = new CGColor[] {UIColor.FromHSBA(hue,1,1,1).CGColor,new CGColor(1,1,1,1)};
            nfloat[] gradLocations = new nfloat[] { 0.0f, 1.0f };

            var colorSpace = CGColorSpace.CreateDeviceRGB ();

            CGGradient gradient = new CGGradient (colorSpace, gradColors, gradLocations);
             context.DrawLinearGradient(gradient,new CGPoint(rect.Size.Width,0),new CGPoint(0,0),CGGradientDrawingOptions.DrawsBeforeStartLocation);

            gradColors = new CGColor[] {new CGColor(0,0,0,0), new CGColor(0,0,0,1)};

            gradient = new CGGradient(colorSpace,gradColors, gradLocations);
             context.DrawLinearGradient(gradient,new CGPoint(0,0),new CGPoint(0,rect.Size.Height),CGGradientDrawingOptions.DrawsBeforeStartLocation);

            gradient.Dispose();
            colorSpace.Dispose();

            //s.Stop();
            //Console.WriteLine("-----> SatBright Draw time: " + s.Elapsed.ToString());
        }
开发者ID:mubold,项目名称:AdvancedColorPicker,代码行数:28,代码来源:SaturationBrightnessPickerView.cs

示例3: CropperResizerView

 internal CropperResizerView(UIColor color = null, nfloat transparancy = default(nfloat), nfloat lineWidth = default(nfloat))
 {
     this.BackgroundColor = UIColor.Clear;
     _color = color ?? UIColor.Red;
     _transparancy = transparancy == 0 ? 0.8f : transparancy;
     _lineWidth = lineWidth == 0 ? 3f : lineWidth;
 }
开发者ID:nielscup,项目名称:ImageCrop,代码行数:7,代码来源:CropperResizerView.cs

示例4: 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();
             }
         }
     }
 }
开发者ID:MilenPavlov,项目名称:treewatch,代码行数:32,代码来源:MultiPolygonView.cs

示例5: CreatePieSegment

        private UIImage CreatePieSegment(CGSize size, nfloat endAngle)
        {
            // Add the arc
            var arc = new CGPath();

            arc.MoveToPoint(size.Width / 2.0f, size.Height / 2.0f);
            arc.AddLineToPoint(size.Width / 2.0f, 0);
            arc.AddArc(size.Width / 2.0f, size.Height / 2.0f, size.Width / 2.0f, _startAngle, endAngle, false);
            arc.AddLineToPoint(size.Width / 2.0f, size.Height / 2.0f);

            // Stroke the arc
            UIGraphics.BeginImageContextWithOptions(size, false, 0);

            var context = UIGraphics.GetCurrentContext();

            context.AddPath(arc);
            context.SetFillColor(UIColor.FromRGBA(0f, 0f, 0f, 1f).CGColor);
            context.FillPath();

            // Get the mask image
            var image = UIGraphics.GetImageFromCurrentImageContext();

            UIGraphics.EndImageContext();

            return image;
        }
开发者ID:Manne990,项目名称:XamTest,代码行数:26,代码来源:CircularProgressViewRenderer.cs

示例6: RCTTargetSize

		private static CGSize RCTTargetSize(CGSize sourceSize, nfloat sourceScale,
			CGSize destSize, nfloat destScale,
			RCTResizeMode resizeMode,
			bool allowUpscaling)
		{
			switch (resizeMode)
			{
				case RCTResizeMode.ScaleToFill:

					if (!allowUpscaling)
					{
						nfloat scale = sourceScale / destScale;
						destSize.Width = (nfloat)Math.Min(sourceSize.Width * scale, destSize.Width);
						destSize.Height = (nfloat)Math.Min(sourceSize.Height * scale, destSize.Height);
					}
					return RCTCeilSize(destSize, destScale);

				default: {

						// Get target size
						CGSize size = RCTTargetRect(sourceSize, destSize, destScale, resizeMode).Size;
						if (!allowUpscaling)
						{
							// return sourceSize if target size is larger
							if (sourceSize.Width * sourceScale < size.Width * destScale)
							{
								return sourceSize;
							}
						}
						return size;
					}
			}
		}
开发者ID:petlack,项目名称:FFImageLoading,代码行数:33,代码来源:NSDataExtensions.cs

示例7: CropByX

        public static UIImage CropByX(this UIImage image, nfloat x)
        {
            UIGraphics.BeginImageContextWithOptions(new CGSize(image.Size.Width - x, image.Size.Height), false, 0);

            UIImage result = null;

            using (CGContext context = UIGraphics.GetCurrentContext())
            {
                context.TranslateCTM(0, image.Size.Height);
                context.ScaleCTM(1, -1);

                context.DrawImage(new CGRect(CGPoint.Empty, image.Size), image.CGImage);

                using (CGImage img = context.AsBitmapContext().ToImage())
                {
                    result = new UIImage(img, image.CurrentScale, UIImageOrientation.Up);
                    img.Dispose();
                }

                context.Dispose();
                UIGraphics.EndImageContext();
            }

            return result;
        }
开发者ID:evnik,项目名称:UIFramework,代码行数:25,代码来源:UIImageExtension.cs

示例8: CalloutAnnotation

        public CalloutAnnotation(int count, CGRect rect, nfloat lineWidth, UIColor color)
        {
            Path = UIBezierPath.FromOval(rect);
            Path.LineWidth = lineWidth;

            var center = new CGPoint (rect.GetMidX(), rect.GetMidY());

            Center = center;

            nfloat startAngle = (nfloat)(Math.PI * 0.75);
            nfloat endAngle = (nfloat)(Math.PI * 0.60);

            Clip = UIBezierPath.FromArc(center, center.X + lineWidth, startAngle, endAngle, true);
            Clip.AddLineTo(center);
            Clip.ClosePath();
            Clip.LineWidth = lineWidth;

            Tail = new UIBezierPath ();
            Tail.MoveTo(new CGPoint (center.X - 11, center.Y + 9));
            Tail.AddLineTo(new CGPoint (center.X - 11, center.Y + 18));
            Tail.AddLineTo(new CGPoint (center.X - 3, center.Y + 13));
            Tail.LineWidth = lineWidth;

            Rect = rect;
            Color = color;
            Count = count;
        }
开发者ID:colbylwilliams,项目名称:bugtrap,代码行数:27,代码来源:CalloutAnnotation.cs

示例9: DashboardGraphView

 //FromRGB (234, 105, 92);
 public DashboardGraphView(CGRect frame, int lineWidth, nfloat degrees)
 {
     _lineWidth = lineWidth;
     _degrees = degrees;
     this.Frame = new CGRect(frame.X, frame.Y, frame.Width, frame.Height);
     this.BackgroundColor = UIColor.Clear;
 }
开发者ID:sarathdev,项目名称:Circle-Di-Graph,代码行数:8,代码来源:DashboardGraphView.cs

示例10: Draw

        //Generated with PaintCode 2.2
        public override void Draw(CGRect rect)
        {
            base.Draw(rect);

            // General Declarations
            var colorSpace = CGColorSpace.CreateDeviceRGB();
            var context = UIGraphics.GetCurrentContext();

            // Color Declarations
            var darkBlue = UIColor.FromRGBA(0.053f, 0.123f, 0.198f, 1.000f);
            var lightBlue = UIColor.FromRGBA(0.191f, 0.619f, 0.845f, 1.000f);

            // Gradient Declarations
            var backgroundGradientColors = new CGColor [] {lightBlue.CGColor, darkBlue.CGColor};
            var backgroundGradientLocations = new nfloat [] {0.0f, 1.0f};
            var backgroundGradient = new CGGradient(colorSpace, backgroundGradientColors, backgroundGradientLocations);

            // Rectangle Drawing
            var rectangleRect = new CGRect(rect.GetMinX() + (float)Math.Floor(rect.Width * -0.12917f + 0.5f), rect.GetMinY() + (float)Math.Floor(rect.Height * 0.00000f + 0.5f), (float)Math.Floor(rect.Width * 1.00000f + 0.5f) - (float)Math.Floor(rect.Width * -0.12917f + 0.5f), (float)Math.Floor(rect.Height * 1.00000f + 0.5f) - (float)Math.Floor(rect.Height * 0.00000f + 0.5f));
            var rectanglePath = UIBezierPath.FromRect(rectangleRect);
            context.SaveState();
            rectanglePath.AddClip();
            context.DrawLinearGradient(backgroundGradient,
                new PointF((float)rectangleRect.GetMidX(), (float)rectangleRect.GetMinY()),
                new PointF((float)rectangleRect.GetMidX(), (float)rectangleRect.GetMaxY()),
                0);
            context.RestoreState();
        }
开发者ID:magicdukeman,项目名称:Giannios_John_Portfolio,代码行数:29,代码来源:BackgroundView.cs

示例11: 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));
            }
        }
开发者ID:KiranKumarAlugonda,项目名称:TXTSHD,代码行数:26,代码来源:DrawBorder.cs

示例12: ToImage

        public static UIImage ToImage(this AtlassianIcon @this, nfloat size, bool cache = true)
        {
            var cacheDir = NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.CachesDirectory, NSSearchPathDomain.User)[0].Path;

            string extension = string.Empty;
            if (Scale > 1 && Scale < 3)
            {
                extension = "@2x";
            }
            else if (Scale >= 3)
            {
                extension = "@3x";
            }

            var fileName = string.Format("atlassian-{0}-{1}{2}.png", (int)@this.CharacterCode, size, extension);
            var combinedPath = Path.Combine(cacheDir, fileName);

            if (File.Exists(combinedPath))
            {
                var img = cache ? UIImage.FromBundle(combinedPath) : UIImage.FromFile(combinedPath);
                return img.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
            }
            else
            {
                var img = Graphics.ImageFromFont(UIFont.FromName("Atlassian-icons", size), @this.CharacterCode, UIColor.Black);
                if (img == null)
                    return null;
                var pngData = img.AsPNG();
                pngData.Save(combinedPath, false);
                return img.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
            }
        }
开发者ID:xNUTs,项目名称:CodeBucket,代码行数:32,代码来源:AtlassianIconsExtensions.cs

示例13: CreateImage

        private UIImage CreateImage (NSString title, nfloat scale)
        {
            var titleAttrs = new UIStringAttributes () {
                Font = UIFont.FromName ("HelveticaNeue", 13f),
                ForegroundColor = Color.Gray,
            };

            var titleBounds = new CGRect (
                new CGPoint (0, 0),
                title.GetSizeUsingAttributes (titleAttrs)
            );

            var image = Image.TagBackground;
            var imageBounds = new CGRect (
                0, 0,
                (float)Math.Ceiling (titleBounds.Width) + image.CapInsets.Left + image.CapInsets.Right + 4f,
                (float)Math.Ceiling (titleBounds.Height) + image.CapInsets.Top + image.CapInsets.Bottom
            );

            titleBounds.X = image.CapInsets.Left + 2f;
            titleBounds.Y = image.CapInsets.Top;

            UIGraphics.BeginImageContextWithOptions (imageBounds.Size, false, scale);

            try {
                image.Draw (imageBounds);
                title.DrawString (titleBounds, titleAttrs);
                return UIGraphics.GetImageFromCurrentImageContext ();
            } finally {
                UIGraphics.EndImageContext ();
            }
        }
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:32,代码来源:TagChipCache.cs

示例14: DropDownTable

		/// <summary>
		/// Initializes a new instance of UITableView.
		/// </summary>
		/// <param name="data">Source Data.</param>
		/// <param name="cellHeight">cellHeight, use 0 for default.</param>
		/// <param name="fSize">Cell Font size.</param>
		/// <param name="cellSelectedBackgroundColor">Cell selected background color, Use Clear for default</param>
		/// <param name="cellSelectedTextColor">Cell selected text color, Use Clear for default</param>
		public DropDownTable(IList<string> data, nfloat cellHeight,
			nfloat fSize, UIColor cellSelectedBackgroundColor, UIColor cellSelectedTextColor,
			string selectedText = "") : base()
		{
			CellLayoutMarginsFollowReadableWidth = false;
			this.MultipleTouchEnabled = true;
			this._FontSize = fSize;
			this._CellHeight = cellHeight;
			this._CellSBackgroundColor = cellSelectedBackgroundColor;
			this._CellSTextColor = cellSelectedTextColor;

			Source = new DropDownSource (data, this._FontSize, this._CellHeight, this._CellSBackgroundColor, 
				this._CellSTextColor, selectedText);

			//ContentInset =  new UIEdgeInsets(0, -10, 0, 0);
			LayoutMargins = UIEdgeInsets.Zero;
			SeparatorInset = UIEdgeInsets.Zero;

			// select default row
			var idx = data.ToList().FindIndex(x => x == selectedText);
			System.Diagnostics.Debug.WriteLine (idx);
			if (idx >= 0) {
				this.SelectRow (Foundation.NSIndexPath.FromItemSection (idx, 0), false, UITableViewScrollPosition.Top);
			}

			(Source as DropDownSource).OnSelected += RowSelected;
		}
开发者ID:ddomengeaux,项目名称:xamarin-amccorma,代码行数:35,代码来源:DropDownTable.cs

示例15: setSize

		public void setSize()
		{
			//its iPhone. Find out which one?

				CGSize result = UIScreen.MainScreen.Bounds.Size;
				this.width = result.Width;
				this.height = result.Height;
			tableSize.Width = result.Width;
				if(result.Height == 480)
				{
				labelMHWidth = 100;
				tableSize.Height = 200;
				textSize = 13;
				}
				else if(result.Height == 568)
				{
				labelMHWidth = 120;
				tableSize.Height = 360;
				textSize = 15;
				}
				else if(result.Height == 667)
				{
				labelMHWidth = 150;
				tableSize.Height = 500;
				textSize = 15;
				}
				else if(result.Height == 736)
				{
				labelMHWidth = 180;
				tableSize.Height = 580;
				textSize = 17;
				}

		}
开发者ID:tienbui123,项目名称:Mobile-VS2,代码行数:34,代码来源:App.cs


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