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


C# CGRect.GetMaxY方法代码示例

本文整理汇总了C#中CGRect.GetMaxY方法的典型用法代码示例。如果您正苦于以下问题:C# CGRect.GetMaxY方法的具体用法?C# CGRect.GetMaxY怎么用?C# CGRect.GetMaxY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGRect的用法示例。


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

示例1: Draw

        public override void Draw(CGRect rect)
        {
            base.Draw(rect);

            if (BorderWidthAll > 0)
            {
                BorderWidth = new UIEdgeInsets(BorderWidthAll, BorderWidthAll, BorderWidthAll, BorderWidthAll);
            }

            if (BorderColorAll != null)
            {
                BorderColorTop = BorderColorBottom = BorderColorLeft = BorderColorRight = BorderColorAll;
            }

            var xMin = rect.GetMinX();
            var xMax = rect.GetMaxX();

            var yMin = rect.GetMinY();
            var yMax = rect.GetMaxY();

            var fWidth = this.Frame.Size.Width;
            var fHeight = this.Frame.Size.Height;

            var context = UIGraphics.GetCurrentContext();

            if (context != null)
                DrawBorders(context, xMin, xMax, yMin, yMax, fWidth, fHeight);
        }
开发者ID:KiranKumarAlugonda,项目名称:TXTSHD,代码行数:28,代码来源:DrawBorder.cs

示例2: 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

示例3: ViewWillAppear

		public override void ViewWillAppear (bool animated)
		{
			CGRect frame = View.Frame;

			var backGround = new UIImageView (UIImage.FromBundle ("background.png"));
			backGround.Alpha = 0.34f;
			View.AddSubview (backGround);

			var miniPadFrame = new CGRect (350, 50, 0, 0);
			miniPadView = new MiniPadView (miniPadFrame);
			View.AddSubview (miniPadView);

			var meterFrame = new CGRect (miniPadView.Frame.GetMaxX (), miniPadFrame.Y, 200, miniPadView.Frame.Size.Height);
			meterView = new ZombieMeter (meterFrame);
			View.AddSubview (meterView);

			var statusFrame = new CGRect (100, frame.Size.Height - 350, frame.Size.Width - 100, 100);
			statusView = new StatusView (statusFrame);
			View.AddSubview (statusView);
			statusView.Status = "Loading";

			var buttonsFrame = new CGRect (100, statusFrame.GetMaxY () + 20, frame.Size.Width - 100, 230);
			buttonsView = new ButtonCollectionView (buttonsFrame) {
				ShouldGroupAccessibilityChildren = true
			};
			buttonsView.ButtonSelectedEvent += ButtonSelected;
			buttonsView.ButtonDraggedEvent += ButtonDragged;
			buttonsView.ButtonFinishedEvent += ButtonFinished;
			View.AddSubview (buttonsView);

			var questionFrame = new CGRect (10, statusFrame.GetMaxY () + 110, 80, 80);
			var questionView = new SymbolMarkView (questionFrame) {
				AccessibilityLabel = "Help"
			};
			questionView.TouchUpInside += (s, e) => questionPressed ();
			View.AddSubview (questionView);
			questionView.Symbol = "?";

			meterView.ZombieLevel = 0;
			goForthZombies ();
			NSNotificationCenter.DefaultCenter.AddObserver (this, new Selector ("voiceOverFinished:"), null, null);
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:42,代码来源:ViewController.cs

示例4: Draw

        public override void Draw(CGRect rect)
        {
            using (var context = UIGraphics.GetCurrentContext ()) {

                // get the scale from the context by getting the current transform matrix, then asking for
                // its "a" component, which is one of the two scale components. We could also ask for "d".
                // This assumes (safely) that the view is being scaled equally in both dimensions.
                var scale = context.GetCTM ().xx;
                CATiledLayer tiledLayer = (CATiledLayer)this.Layer;
                var tileSize = tiledLayer.TileSize;

                // Even at scales lower than 100%, we are drawing into a rect in the coordinate system of the full
                // image. One tile at 50% covers the width (in original image coordinates) of two tiles at 100%.
                // So at 50% we need to stretch our tiles to double the width and height; at 25% we need to stretch
                // them to quadruple the width and height; and so on.
                // (Note that this means that we are drawing very blurry images as the scale gets low. At 12.5%,
                // our lowest scale, we are stretching about 6 small tiles to fill the entire original image area.
                // But this is okay, because the big blurry image we're drawing here will be scaled way down before
                // it is displayed.)
                tileSize.Width /= scale;
                tileSize.Height /= scale;

                // calculate the rows and columns of tiles that intersect the rect we have been asked to draw
                int firstCol = (int)Math.Floor (rect.GetMinX () / tileSize.Width);
                int lastCol = (int)Math.Floor ((rect.GetMaxX () - 1) / tileSize.Width);
                int firstRow = (int)Math.Floor (rect.GetMinY () / tileSize.Height);
                int lastRow = (int)Math.Floor ((rect.GetMaxY () - 1) / tileSize.Height);

                for (int row = firstRow; row <= lastRow; row++) {
                    for (int col = firstCol; col <= lastCol; col++) {

                        UIImage tile = TileForScale ((float)scale, row, col);
                        var tileRect = new CGRect (tileSize.Width * col, tileSize.Height * row, tileSize.Width, tileSize.Height);
                        // if the tile would stick outside of our bounds, we need to truncate it so as to avoid
                        // stretching out the partial tiles at the right and bottom edges
                        tileRect.Intersect (this.Bounds);
                        tile.Draw (tileRect);
                    }
                }
            }
        }
开发者ID:Rajneesh360Logica,项目名称:monotouch-samples,代码行数:41,代码来源:TilingView.cs

示例5: ComputeDifferenceBetweenRect

		static void ComputeDifferenceBetweenRect (CGRect oldRect, CGRect newRect, Action<CGRect> removedHandler, Action<CGRect> addedHandler)
		{
			if (!oldRect.IntersectsWith (newRect)) {
				addedHandler (newRect);
				removedHandler (oldRect);
			} else {
				nfloat oldMaxY = oldRect.GetMaxY ();
				nfloat oldMinY = oldRect.GetMinY ();
				nfloat newMaxY = newRect.GetMaxY ();
				nfloat newMinY = newRect.GetMinY ();

				if (newMaxY > oldMaxY) {
					var rectToAdd = new CGRect (newRect.X, oldMaxY, newRect.Width, newMaxY - oldMaxY);
					addedHandler(rectToAdd);
				}

				if (oldMinY > newMinY) {
					var rectToAdd = new CGRect (newRect.X, newMinY, newRect.Width, oldMinY - newMinY);
					addedHandler(rectToAdd);
				}

				if (newMaxY < oldMaxY) {
					var rectToRemove = new CGRect (newRect.X, newMaxY, newRect.Width, oldMaxY - newMaxY);
					removedHandler(rectToRemove);
				}

				if (oldMinY < newMinY) {
					var rectToRemove = new CGRect (newRect.X, oldMinY, newRect.Width, newMinY - oldMinY);
					removedHandler(rectToRemove);
				}
			}
		}
开发者ID:BytesGuy,项目名称:monotouch-samples,代码行数:32,代码来源:AssetGridViewController.cs

示例6: DisplayPixelBuffer

		public void DisplayPixelBuffer (CVPixelBuffer pixelBuffer)
		{
			DrawTextInCorner (pixelBuffer);
			CVReturn error;

			if (pixelBuffer != null) {
				int frameWidth = (int)pixelBuffer.Width;
				int frameHeight = (int)pixelBuffer.Height;

				if (videoTextureCache == null) {
					Console.WriteLine ("No video texture cache");
					return;
				}

				CleanUpTextures ();
				CVAttachmentMode attachmentMode;
				var colorAttachments = pixelBuffer.GetAttachment <NSString> (CVImageBuffer.YCbCrMatrixKey, out attachmentMode);

				if (colorAttachments == CVImageBuffer.YCbCrMatrix_ITU_R_601_4)
					preferredConversion = colorConversion601;
				else
					preferredConversion = colorConversion709;

				GL.ActiveTexture (TextureUnit.Texture0);
				lumaTexture = videoTextureCache.TextureFromImage (pixelBuffer, true, All.RedExt, frameWidth, frameHeight,
					All.RedExt, DataType.UnsignedByte, 0, out error);

				if (lumaTexture == null)
					Console.WriteLine ("Error at CVOpenGLESTextureCach.TextureFromImage");

				GL.BindTexture (lumaTexture.Target, lumaTexture.Name);
				GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.Linear);
				GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear);
				GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)All.ClampToEdge);
				GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)All.ClampToEdge);

				GL.ActiveTexture (TextureUnit.Texture1);
				chromaTexture = videoTextureCache.TextureFromImage (pixelBuffer, true, All.RgExt, frameWidth / 2, frameHeight / 2,
					All.RgExt, DataType.UnsignedByte, 1, out error);

				if (chromaTexture == null)
					Console.WriteLine ("Error at CVOpenGLESTextureCach.TextureFromImage");

				GL.BindTexture (chromaTexture.Target, chromaTexture.Name);
				GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.Linear);
				GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear);
				GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)All.ClampToEdge);
				GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)All.ClampToEdge);

				GL.BindFramebuffer (FramebufferTarget.Framebuffer, frameBufferHandle);
				GL.Viewport (0, 0, backingWidth, backingHeight);
			}

			GL.ClearColor (0f, 0f, 0f, 1f);
			GL.Clear (ClearBufferMask.ColorBufferBit);

			GL.UseProgram (Program);
			GL.Uniform1 (uniforms [(int)UniformIndex.RotationAngle], 0f);
			GL.UniformMatrix3 (uniforms [(int)UniformIndex.ColorConversionMatrix], 1, false, preferredConversion);

			CGRect vertexSamplingRect = AVUtilities.WithAspectRatio (Bounds, PresentationRect);

			var normalizedSamplingSize = new CGSize (0f, 0f);
			var cropScaleAmount = new CGSize (vertexSamplingRect.Width / Bounds.Width, vertexSamplingRect.Height / Bounds.Height);

			if (cropScaleAmount.Width > cropScaleAmount.Height) {
				normalizedSamplingSize.Width = 1f;
				normalizedSamplingSize.Height = cropScaleAmount.Height / cropScaleAmount.Width;
			} else {
				normalizedSamplingSize.Width = 1f;
				normalizedSamplingSize.Height = cropScaleAmount.Width / cropScaleAmount.Height;
			}

			float[] quadVertexData = {
				-1f * (float)normalizedSamplingSize.Width, -1f * (float)normalizedSamplingSize.Height,
				(float)normalizedSamplingSize.Width, -1f * (float)normalizedSamplingSize.Height,
				-1f * (float)normalizedSamplingSize.Width, (float)normalizedSamplingSize.Height,
				(float)normalizedSamplingSize.Width, (float)normalizedSamplingSize.Height,
			};

			GL.VertexAttribPointer ((int)AttributeIndex.Vertex, 2, VertexAttribPointerType.Float, false, 0, quadVertexData);
			GL.EnableVertexAttribArray ((int)AttributeIndex.Vertex);

			var textureSamplingRect = new CGRect (0, 0, 1, 1);
			float[] quadTextureData = {
				(float)textureSamplingRect.GetMinX (), (float)textureSamplingRect.GetMaxY (),
				(float)textureSamplingRect.GetMaxX (), (float)textureSamplingRect.GetMaxY (),
				(float)textureSamplingRect.GetMinX (), (float)textureSamplingRect.GetMinY (),
				(float)textureSamplingRect.GetMaxX (), (float)textureSamplingRect.GetMinY ()
			};

			GL.VertexAttribPointer ((int)AttributeIndex.TextureCoordinates, 2, VertexAttribPointerType.Float, false, 0, quadTextureData);
			GL.EnableVertexAttribArray ((int)AttributeIndex.TextureCoordinates);

			GL.DrawArrays (BeginMode.TriangleStrip, 0, 4);
			GL.BindRenderbuffer (RenderbufferTarget.Renderbuffer, colorBufferHandle);
			context.PresentRenderBuffer ((int)RenderbufferTarget.Renderbuffer);
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:98,代码来源:EAGLLayer.cs

示例7: drawArc

 private void drawArc(CGContext context, CGRect rect)
 {
     var radius = rect.GetMaxY() * badgeCornerRoundness;
     var puffer = new nfloat(Padding(rect));
     var maxX = rect.GetMaxX() - puffer;
     var maxY = rect.GetMaxY() - puffer;
     var minX = rect.GetMinX() + puffer;
     var minY = rect.GetMinY() + puffer;
     double pi = Math.PI;
     context.AddArc(new nfloat(maxX - radius), new nfloat(minY + radius), new nfloat(radius), new nfloat(pi + (pi / 2)), 0, false);
     context.AddArc(new nfloat(maxX - radius), new nfloat(minY - radius), new nfloat(radius), 0, new nfloat(pi / 2), false);
 }
开发者ID:Jurabek,项目名称:Restaurant,代码行数:12,代码来源:UIBarButtonItem.cs

示例8: Padding

 private double Padding(CGRect rect)
 {
     return rect.GetMaxY() * 0.10;
 }
开发者ID:Jurabek,项目名称:Restaurant,代码行数:4,代码来源:UIBarButtonItem.cs

示例9: ComputeDifferenceBetweenRect

		static Rects ComputeDifferenceBetweenRect (CGRect oldRect, CGRect newRect)
		{
			if (!oldRect.IntersectsWith (newRect)) {
				return new Rects {
					Added = new CGRect [] { newRect },
					Removed = new CGRect [] { oldRect }
				};
			}

			var oldMaxY = oldRect.GetMaxY ();
			var oldMinY = oldRect.GetMinY ();
			var newMaxY = newRect.GetMaxY ();
			var newMinY = newRect.GetMinY ();

			var added = new List<CGRect> ();
			var removed = new List<CGRect> ();

			if (newMaxY > oldMaxY)
				added.Add (new CGRect (newRect.X, oldMaxY, newRect.Width, newMaxY - oldMaxY));

			if (oldMinY > newMinY)
				added.Add (new CGRect (newRect.X, newMinY, newRect.Width, oldMinY - newMinY));

			if (newMaxY < oldMaxY)
				removed.Add (new CGRect (newRect.X, newMaxY, newRect.Width, oldMaxY - newMaxY));

			if (oldMinY < newMinY)
				removed.Add (new CGRect (newRect.X, oldMinY, newRect.Width, newMinY - oldMinY));

			return new Rects {
				Added = added,
				Removed = removed
			};
		}
开发者ID:xamarin,项目名称:monotouch-samples,代码行数:34,代码来源:AssetGridViewController.cs

示例10: ComputeDifferenceBetweenRect

		private void ComputeDifferenceBetweenRect (CGRect oldRect, CGRect newRect, Action<CGRect> removedHandler, Action<CGRect> addedHandler)
		{
			if (CGRect.Intersect (newRect, oldRect) != CGRect.Empty) {
				var oldMaxY = oldRect.GetMaxY ();
				var oldMinY = oldRect.GetMinY ();
				var newMaxY = newRect.GetMaxY ();
				var newMinY = newRect.GetMinY ();

				if (newMaxY > oldMaxY) {
					var rectToAdd = new CGRect (newRect.X, oldMaxY, newRect.Size.Width, (newMaxY - oldMaxY));
					addedHandler (rectToAdd);
				}
				if (oldMinY > newMinY) {
					var rectToAdd = new CGRect (newRect.X, newMinY, newRect.Size.Width, (oldMinY - newMinY));
					addedHandler (rectToAdd);
				}
				if (newMaxY < oldMaxY) {
					var rectToRemove = new CGRect (newRect.X, newMaxY, newRect.Size.Width, (oldMaxY - newMaxY));
					removedHandler (rectToRemove);
				}
				if (oldMinY < newMinY) {
					var rectToRemove = new CGRect (newRect.X, oldMinY, newRect.Size.Width, (newMinY - oldMinY));
					removedHandler (rectToRemove);
				}
			} else {
				addedHandler (newRect);
				removedHandler (oldRect);
			}
		}
开发者ID:Cybrosys,项目名称:GMImagePicker.Xamarin,代码行数:29,代码来源:GMGridViewController.cs

示例11: Draw

		public override void Draw (CGRect rect)
		{
			base.Draw (rect);


			_highTemps = null;
			_lowTemps = null;

			_hourlyTemps = null;


			if (Forecasts.Count == 0 || Hourly.Count == 0) return;


			graphRect = new CGRect (rect.X + padding, rect.Y + padding, rect.Width - (padding * 2), rect.Height - (padding * 2));


			var days = Hourly.GroupBy (h => h.FCTTIME.mday).Select (g => g.First ().FCTTIME.weekday_name_abbrev).ToList ();

			var dayCount = hourly ? days.Count : Forecasts.Count;


			var xAxisScale = (graphRect.Width + padding / 2) / dayCount;

			inset = xAxisScale / 2;


			var highest = (nfloat)(hourly ? HourlyTemps.Max () : HighTemps.Max ());
			var lowest = (nfloat)(hourly ? HourlyTemps.Min () : LowTemps.Min ());


			scaleHigh = NMath.Round (highest, MidpointRounding.AwayFromZero);
			scaleLow = lowest < 0 ? NMath.Round (lowest, MidpointRounding.AwayFromZero) : NMath.Round (lowest);

			var rangePadding = Settings.UomTemperature.IsImperial () ? scalePadding : (scalePadding / 2);


			scaleHigh += rangePadding;
			scaleLow -= rangePadding;

			scaleRange = scaleHigh - scaleLow;


			var scaleIncrement = scaleRange / dividerCount;

			scaleX = (graphRect.Width - inset) / (hourly ? HourlyTemps.Count : Forecasts.Count);
			scaleY = graphRect.Height / dividerCount;


			nfloat x, y;


			using (CGContext ctx = UIGraphics.GetCurrentContext ()) {

				// Draw x and y axis
				using (UIColor color = UIColor.White) {

					color.SetStroke ();
					ctx.SetLineWidth (1);

					using (CGPath p = new CGPath ()) {

						p.MoveToPoint (graphRect.GetMinX (), graphRect.GetMaxY ());

						p.AddLines (new [] {
							new CGPoint (graphRect.GetMinX (), graphRect.GetMinY ()),
							new CGPoint (graphRect.GetMinX (), graphRect.GetMaxY ()),
							new CGPoint (graphRect.GetMaxX (), graphRect.GetMaxY ())
						});

						ctx.AddPath (p);
						ctx.DrawPath (CGPathDrawingMode.Stroke);
					}
				}


				// Draw horizontal gridlines
				using (UIColor color = UIColor.Black.ColorWithAlpha (0.08f)) {

					for (int i = 1; i < dividerCount; i += 2) {

						y = (i + 1) * scaleY;

						color.SetFill ();
						ctx.FillRect (new CGRect (graphRect.GetMinX (), graphRect.GetMaxY () - y, graphRect.Width, scaleY));
						ctx.StrokePath ();
					}
				}



				drawLines ();


				// Draw y-axis labels

				nfloat yStep = scaleLow;

				ctx.SaveState ();
				ctx.TranslateCTM (0, rect.Height);
//.........这里部分代码省略.........
开发者ID:colbylwilliams,项目名称:XWeather,代码行数:101,代码来源:DailyGraphView.cs


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