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


C# Xwt.DrawImage方法代码示例

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


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

示例1: OnDraw

        protected override void OnDraw(Xwt.Drawing.Context ctx)
        {
            base.OnDraw (ctx);

            ctx.SetLineDash (15, 10, 10, 5, 5);
            ctx.Rectangle (100, 100, 100, 100);
            ctx.Stroke ();
            ctx.SetLineDash (0);

            ImageBuilder ib = new ImageBuilder (30, 30, ImageFormat.ARGB32);
            ib.Context.Arc (15, 15, 15, 0, 360);
            ib.Context.SetColor (new Color (1, 0, 1));
            ib.Context.Rectangle (0, 0, 5, 5);
            ib.Context.Fill ();
            var img = ib.ToImage ();
            ctx.DrawImage (img, 90, 90);
            ctx.DrawImage (img, 90, 140, 50, 10);

            ctx.Arc (190, 190, 15, 0, 360);
            ctx.SetColor (new Color (1, 0, 1, 0.4));
            ctx.Fill ();

            ctx.Save ();
            ctx.Translate (90, 220);
            ctx.Pattern = new ImagePattern (img);
            ctx.Rectangle (0, 0, 100, 70);
            ctx.Fill ();
            ctx.Restore ();

            ctx.Translate (30, 30);
            double end = 270;

            for (double n = 0; n<=end; n += 5) {
                ctx.Save ();
                ctx.Rotate (n);
                ctx.MoveTo (0, 0);
                ctx.RelLineTo (30, 0);
                double c = n / end;
                ctx.SetColor (new Color (c, c, c));
                ctx.Stroke ();
                ctx.Restore ();
            }
        }
开发者ID:pixelmeister,项目名称:xwt,代码行数:43,代码来源:DrawingTransforms.cs

示例2: DrawImageSized

        private void DrawImageSized(PageImage pi, Xwt.Drawing.Image im, Xwt.Drawing.Context g, Xwt.Rectangle r)
        {
            double height, width;      // some work variables
            StyleInfo si = pi.SI;

            Xwt.Rectangle r2 = new Xwt.Rectangle(r.X + PixelsX(si.PaddingLeft),
                                                      r.Y + PixelsY(si.PaddingTop),
                                                      r.Width - PixelsX(si.PaddingLeft + si.PaddingRight),
                                                      r.Height - PixelsY(si.PaddingTop + si.PaddingBottom));

            Xwt.Rectangle ir;   // int work rectangle
            switch (pi.Sizing)
            {
                case ImageSizingEnum.AutoSize:

                    float imwidth = PixelsX( (float)im.Size.Width);
                    float imheight = PixelsX( (float)im.Size.Height);
                    ir = new Xwt.Rectangle(Convert.ToInt32(r2.X), Convert.ToInt32(r2.Y),
                                                    imwidth, imheight);

                    im.Scale((int)r2.Width, (int)r2.Height);
                    g.DrawImage(im, ir);

                    break;
                case ImageSizingEnum.Clip:
                    g.Save();
                    g.Rectangle(r2);
                    g.Clip();

                    ir = new Xwt.Rectangle(Convert.ToInt32(r2.X), Convert.ToInt32(r2.Y),
                                                    im.Size.Width, im.Size.Height);

                    g.DrawImage(im, ir);
                    g.Restore();
                    break;
                case ImageSizingEnum.FitProportional:
                    double ratioIm = (float)im.Size.Height / (float)im.Size.Width;
                    double ratioR = r2.Height / r2.Width;
                    height = r2.Height;
                    width = r2.Width;
                    if (ratioIm > ratioR)
                    {
                        // this means the rectangle width must be corrected
                        width = height * (1 / ratioIm);
                    }
                    else if (ratioIm < ratioR)
                    {
                        // this means the ractangle height must be corrected
                        height = width * ratioIm;
                    }
                    r2 = new Xwt.Rectangle(r2.X, r2.Y, width, height);
                    g.DrawImage(im, r2);
                    break;
                case ImageSizingEnum.Fit:
                default:
                    g.DrawImage(im, r2);
                    break;
            }
        }
开发者ID:hardsoft,项目名称:My-FyiReporting,代码行数:59,代码来源:RenderXwt.cs

示例3: OnDraw

		protected override void OnDraw (Xwt.Drawing.Context ctx, Xwt.Rectangle dirtyRect)
		{
			base.OnDraw (ctx, dirtyRect);
			if (image != null) {
				ctx.DrawImage (image, 0, 0);
				if (filler != null) {
					int fillCount = (int)Math.Ceiling ((Bounds.Width - image.Width) / filler.Width);
					double x = image.Width;
					while ((fillCount--) > 0) {
						ctx.DrawImage (filler, x, 0);
						x += filler.Width;
					}
				}
			}
		}
开发者ID:telebovich,项目名称:monodevelop,代码行数:15,代码来源:OptionsDialog.cs

示例4: OnDraw

        protected override void OnDraw(Xwt.Drawing.Context ctx, Rectangle dirtyRect)
        {
            if (!Sensitive)
            {
                ctx.GlobalAlpha = .5d;
            }
            if (image == null)
            {
                ctx.SetColor(bg);
                ctx.Rectangle(dirtyRect);
                ctx.Fill();
            }
            else
                ctx.DrawImage(image, new Rectangle(0, 0, WidthRequest, HeightRequest));

            if (mOver && Sensitive)
            {
                ctx.SetColor(mOverColor);
                ctx.Rectangle(dirtyRect);
                ctx.Fill();
            }

            if (mDown)
            {
                ctx.SetColor(mOverColor);
                ctx.Rectangle(dirtyRect);
                ctx.Fill();
            }

            //ctx.SetColor(Colors.Red);
            //ctx.Rectangle(0, 0, WidthRequest, HeightRequest);
            //ctx.Stroke();
        }
开发者ID:fourtf,项目名称:4Plug,代码行数:33,代码来源:ImageButton.cs

示例5: OnDraw

 protected override void OnDraw(Xwt.Drawing.Context ctx, Xwt.Rectangle dirtyRect)
 {
     int width = (int)this.Size.Width, height = (int)this.Size.Height;
     ctx.DrawImage(Build(width, height), new Xwt.Point(0, 0), this.ParentWindow.Screen.ScaleFactor);
 }
开发者ID:ksigne,项目名称:xwt-extensions,代码行数:5,代码来源:SignalControl.cs

示例6: OnDraw

        protected override void OnDraw(Xwt.Drawing.Context ctx)
        {
            base.OnDraw (ctx);

            // Simple rectangles

            ctx.SetLineWidth (1);
            ctx.Rectangle (100, 5, 10, 10);
            ctx.SetColor (Color.Black);
            ctx.Fill ();

            ctx.Rectangle (115, 5, 10, 10);
            ctx.SetColor (Color.Black);
            ctx.Stroke ();

            //

            ctx.SetLineWidth (3);
            ctx.Rectangle (100, 20, 10, 10);
            ctx.SetColor (Color.Black);
            ctx.Fill ();

            ctx.Rectangle (115, 20, 10, 10);
            ctx.SetColor (Color.Black);
            ctx.Stroke ();

            // Rectangle with hole

            ctx.Rectangle (10, 100, 40, 40);
            ctx.MoveTo (45, 135);
            ctx.RelLineTo (0, -20);
            ctx.RelLineTo (-20, 0);
            ctx.RelLineTo (0, 20);
            ctx.ClosePath ();
            ctx.SetColor (Color.Black);
            ctx.Fill ();

            // Dashed lines

            ctx.SetLineDash (15, 10, 10, 5, 5);
            ctx.Rectangle (100, 100, 100, 100);
            ctx.Stroke ();
            ctx.SetLineDash (0);

            ImageBuilder ib = new ImageBuilder (30, 30, ImageFormat.ARGB32);
            ib.Context.Arc (15, 15, 15, 0, 360);
            ib.Context.SetColor (new Color (1, 0, 1));
            ib.Context.Rectangle (0, 0, 5, 5);
            ib.Context.Fill ();
            var img = ib.ToImage ();
            ctx.DrawImage (img, 90, 90);
            ctx.DrawImage (img, 90, 140, 50, 10);

            ctx.Arc (190, 190, 15, 0, 360);
            ctx.SetColor (new Color (1, 0, 1, 0.4));
            ctx.Fill ();

            ctx.Save ();
            ctx.Translate (90, 220);
            ctx.Pattern = new ImagePattern (img);
            ctx.Rectangle (0, 0, 100, 70);
            ctx.Fill ();
            ctx.Restore ();

            ctx.Translate (30, 30);
            double end = 270;

            for (double n = 0; n<=end; n += 5) {
                ctx.Save ();
                ctx.Rotate (n);
                ctx.MoveTo (0, 0);
                ctx.RelLineTo (30, 0);
                double c = n / end;
                ctx.SetColor (new Color (c, c, c));
                ctx.Stroke ();
                ctx.Restore ();
            }

            ctx.ResetTransform ();
        }
开发者ID:chkn,项目名称:xwt,代码行数:80,代码来源:DrawingTransforms.cs

示例7: OnDraw

        protected override void OnDraw(Xwt.Drawing.Context ctx, Xwt.Rectangle dirtyRect)
        {
            if (ParentWindow.Visible)
            {
                System.Drawing.Bitmap B = new System.Drawing.Bitmap((int)(dirtyRect.Width * this.ParentWindow.Screen.ScaleFactor), (int)(dirtyRect.Height * this.ParentWindow.Screen.ScaleFactor));
                System.Drawing.Graphics G = System.Drawing.Graphics.FromImage(B);

                G.FillRectangle(
                    new System.Drawing.SolidBrush(System.Drawing.Color.White),
                    new System.Drawing.Rectangle(0, 0, B.Width - 1, B.Height - 1)
                );
                List<GradientButton> S = this.Buttons.OrderBy(X => X.CurrentMode).ToList();
                S.ForEach(X =>
                    {
                        X.DrawDescription = (X.Size.Width != this.ButtonSize);
                        X.DrawImg = true;
                        X.Draw(G, new System.Drawing.PointF((float)X.Position.X, (float)X.Position.Y), this.ParentWindow.Screen.ScaleFactor);
                    });
                ctx.DrawImage(B, new Point(0, 0), this.ParentWindow.Screen.ScaleFactor);
            }
        }
开发者ID:ksigne,项目名称:xwt-extensions,代码行数:21,代码来源:CarouselTable.cs

示例8: OnDraw

        protected override void OnDraw(Xwt.Drawing.Context ctx, Rectangle dirtyRect)
        {
            if (Bounds.IsEmpty)
                return;

            // Copy plotCache to on-screen display
            ctx.DrawImage (plotImage, dirtyRect);

            // draw some overlay over this
            DrawFocus (ctx, cursorX, cursorY);
        }
开发者ID:hwthomas,项目名称:controlsuite,代码行数:11,代码来源:SimplePlotCanvas.cs


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