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


C# Rect.Set方法代码示例

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


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

示例1: GetItemOffsets

 public override void GetItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state)
 {
     base.GetItemOffsets(outRect, view, parent, state);
     if (this.GetOrientation(parent) == LinearLayoutManager.Vertical) 
     {
         outRect.Set(0, 0, 0, this.divider.IntrinsicHeight);
     } else {
         outRect.Set(0, 0, this.divider.IntrinsicWidth, 0);
     }
 }
开发者ID:fabionuno,项目名称:Timehop.StickyHeadersRecyclerView,代码行数:10,代码来源:DividerDecoration.cs

示例2: GetItemOffsets

 public override void GetItemOffsets (Rect outRect, View view, RecyclerView parent, RecyclerView.State state)
 {
     if (orientation == VerticalList) {
         outRect.Set (0, 0, 0, divider.IntrinsicHeight);
     } else {
         outRect.Set (0, 0, divider.IntrinsicWidth, 0);
     }
 }
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:8,代码来源:DividerItemDecoration.cs

示例3: DoDraw

        private void DoDraw(Canvas canvas)
        {
			// Increment / reset
            size += delta;
            if (size > 250)
            {
				delta = -1;
            } 
			else if (size < 30) 
			{
				delta = 1;
			}

            // Set background color
            canvas.DrawColor(Color.BLUE); 
            var paint = new Paint();
            paint.TextAlign =(Paint.Align.CENTER);

            // Draw some lines
            canvas.DrawLine(mX, mY, mY + 33, mX + 100, paint);
            paint.Color =(Color.RED);
            paint.StrokeWidth = (10);
            canvas.DrawLine(87, 0, 75, 100, paint);
            paint.Color =(Color.GREEN);
            paint.StrokeWidth = (5);
            for (int y = 30, alpha = 128; alpha > 2; alpha >>= 1, y += 10)
            {
                paint.Alpha = (alpha);

                canvas.DrawLine(mY, y, mY + 100, y, paint);
            }

            // Draw a red rectangle
            paint.Color =(Color.RED);
            var rect = new Rect();
            rect.Set(size + 120, 130, size + 156, 156);
            canvas.DrawRect(rect, paint);

            // Draw a circle
            paint.Color =(Color.ParseColor("#ffd700"));
            canvas.DrawCircle(size * 2, 220, 30, paint); //faster circle

            // Draw red'ish rectangle
            paint.Color =(Color.Rgb(128, 20, 20));
            canvas.DrawRect(size, 67, 68, 45, paint);

            // Draw green circle
            paint.Color =(Color.GREEN);
            canvas.DrawCircle(size, 140.0f - size / 3, 45.0f, paint); //move circle across screen
            paint.Color =(Color.RED);
            canvas.DrawText("Dot42", size, 140.0f - size / 3, paint);

            // Draw magenta circle
            paint.Color =(Color.MAGENTA);
            canvas.DrawCircle(mX, mY, size / 4.0f, paint); //move circle down screen
            paint.Color =(Color.GREEN);
            canvas.DrawText("is", mX, mY, paint);

            // Draw yellow rectangle
            paint.Alpha = (64);
            paint.Color =(Color.YELLOW);
            canvas.DrawRect(size, size, size + 45, size + 45, paint);
            // Draw text on rectangle
            paint.Alpha = (255);
            paint.Color =(Color.DKGRAY);
            canvas.DrawText("fun!", size + 45 / 2, size + 45 / 2, paint);
        }
开发者ID:Xtremrules,项目名称:dot42,代码行数:67,代码来源:Panel.cs

示例4: GetItemOffsets

 public override void GetItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state)
 {
     outRect.Set(0, 0, 0, divider.IntrinsicHeight);
 }
开发者ID:nepula-h-okuyama,项目名称:DroidKaigi2016Xamarin,代码行数:4,代码来源:DividerItemDecoration.cs

示例5: OnDraw

		protected override void OnDraw(Canvas ca)  {

			if (fullImage == null || shouldUpdate) {

				fullImage = Bitmap.CreateBitmap (Width, Height, Bitmap.Config.Argb8888);
				Canvas canvas = new Canvas(fullImage);
				canvas.DrawColor(Color.Transparent);
				//NinePatchDrawable popup = (NinePatchDrawable)this.Resources.GetDrawable (Android.Resource.Drawable.AlertDarkFrame);

				float maxValue = 0;
				float padding = 7;
				int selectPadding = 4;
				float bottomPadding = 40;
				float usableHeight;
				if (showBarText) {
					this.p.TextSize = 40;
					this.p.GetTextBounds(unit, 0, 1, r3);
					usableHeight = Height - bottomPadding - Math.Abs(r3.Top - r3.Bottom) - 26;
				} else {
					usableHeight = Height - bottomPadding;
				}

				p.Color = Color.Black;
				p.StrokeWidth = 2;
				p.Alpha = 50;
				p.AntiAlias = true;

				canvas.DrawLine(0, Height - bottomPadding + 10, Width, Height - bottomPadding + 10, p);

				float barWidth = (Width - (padding * 2) * points.Count) / points.Count;

				foreach (Bar po in points) {
					maxValue += po.getValue();
				}

				r = new Rect();

				path.Reset();

				int count = 0;
				foreach (Bar po in points) {

					if(po.getStackedBar()){
						List<BarStackSegment> values = new List<BarStackSegment>(po.getStackedValues());
						int prevValue = 0;
						foreach (BarStackSegment value in values) {
							value.Value += prevValue;
							prevValue += value.Value;
						}
						//Collections.Reverse(values);

						foreach (BarStackSegment value in values) {
							r.Set((int) ((padding * 2) * count + padding + barWidth * count), (int) ((Height - bottomPadding - (usableHeight * (value.Value / maxValue)))), (int) ((padding * 2) * count + padding + barWidth * (count + 1)), (int) ((Height - bottomPadding)));
							path.AddRect(new RectF(r.Left - selectPadding, r.Top - selectPadding, r.Right + selectPadding, r.Bottom + selectPadding), Path.Direction.Cw);
							po.setPath(path);
							po.setRegion(new Region(r.Left - selectPadding, r.Top - selectPadding, r.Right + selectPadding, r.Bottom + selectPadding));
							this.p.Color = value.Color;
							this.p.Alpha = 255;
							canvas.DrawRect (r, this.p);
						}
					}else {
						r.Set((int) ((padding * 2) * count + padding + barWidth * count), (int) (Height - bottomPadding - (usableHeight * (po.getValue() / maxValue))), (int) ((padding * 2) * count + padding + barWidth * (count + 1)), (int) (Height - bottomPadding));
						path.AddRect(new RectF(r.Left - selectPadding, r.Top - selectPadding, r.Right + selectPadding, r.Bottom + selectPadding), Path.Direction.Cw);
						po.setPath(path);
						po.setRegion(new Region(r.Left - selectPadding, r.Top - selectPadding, r.Right + selectPadding, r.Bottom + selectPadding));
						this.p.Color = po.getColor ();
						this.p.Alpha=255;
						canvas.DrawRect(r, this.p);
					}

					this.p.TextSize = 20;
					canvas.DrawText(po.getName(), (int) (((r.Left + r.Right) / 2) - (this.p.MeasureText(po.getName()) / 2)), Height - 5, this.p);
					if (showBarText) {
						this.p.TextSize=40;
						this.p.Color=Color.White;
						this.p.GetTextBounds (unit + po.getValue (), 0, 1, r2);
//						if (popup != null)
//							popup.SetBounds((int) (((r.Left + r.Right) / 2) - (this.p.MeasureText(unit + po.getValue()) / 2)) - 14, r.Top + (r2.Top - r2.Bottom) - 26, (int) (((r.Left + r.Right) / 2) + (this.p.MeasureText(unit + po.getValue()) / 2)) + 14, r.Top);
//						popup.Draw(canvas);
						if (isAppended())
							canvas.DrawText(po.getValue() + unit, (int) (((r.Left + r.Right) / 2) - (this.p.MeasureText(unit + po.getValue()) / 2)), r.Top - 20, this.p);
						else
							canvas.DrawText(unit + po.getValue(), (int) (((r.Left + r.Right) / 2) - (this.p.MeasureText(unit + po.getValue()) / 2)), r.Top - 20, this.p);
					}
					if (indexSelected == count && listener != null) {
						this.p.Color = Color.ParseColor ("#33B5E5");
						this.p.Alpha = 100;
						canvas.DrawPath (po.getPath (), this.p);
						this.p.Alpha = 255;
					}
					count++;
				}
				shouldUpdate = false;
			}
			ca.DrawBitmap(fullImage, 0, 0, null);
		}
开发者ID:jeedey93,项目名称:xamarin-android-samples,代码行数:96,代码来源:BarGraph.cs

示例6: InvalidateChildInParent

 public override IViewParent InvalidateChildInParent(int[] location, Rect dirty)
 {
     location[0] = Left;
     location[1] = Top;
     dirty.Set (0, 0, Width, Height);
     return Parent;
 }
开发者ID:vkheleli,项目名称:monodroid-samples-master,代码行数:7,代码来源:PictureLayout.cs


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