• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Drawing.TextureBrush类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Bumper

        public Bumper()
        {
            InitializeComponent();
            Kontroli = Resources.kontrolii;
            flag = false;
            zvukON = Resources.soundON;
            zvukOFF = Resources.soundOFF;
            CarsDoc = new CarsDoc();
            LentiDoc = new LentiDoc();
            DupkiDoc = new DupkiDoc();
            generirajKola = 0;
            poeni = 0;
            level = 1;
            sekundi = 0;
            //asvalt
            img = Properties.Resources.Road2;
            biImg = new Bitmap(img);
            tba = new TextureBrush(biImg);
            clicked = true;

            sounds = new Sounds();

            DoubleBuffered = true;
            random = new Random();
            zgolemiLvl = false;
            bestScore = 0;
            eksplozija = Properties.Resources.explosion_;
            TextReader tr = new StreamReader("highscores.txt");
            lbHighScore.Text = tr.ReadLine() + "pts";
        }
开发者ID:sanjatas,项目名称:Bumper,代码行数:30,代码来源:Form1.cs


示例2: BrushesExampleMethod

        public static void BrushesExampleMethod(Graphics g)
        {
            Color pink = Color.FromArgb(241, 105, 190);
            SolidBrush sldBrush = new SolidBrush(pink);
            g.FillRectangle(sldBrush, 300, 150, 70, 70);

            HatchBrush hBrush = new HatchBrush(HatchStyle.NarrowVertical, Color.Pink, Color.Blue);
            g.FillRectangle(hBrush, 370, 150, 70, 70);

            sldBrush = new SolidBrush(Color.Orchid);
            g.FillRectangle(sldBrush, 440, 150, 70, 70);

            LinearGradientBrush lgBrush = new LinearGradientBrush(new Rectangle(0, 0, 20, 20), Color.Violet, Color.LightSteelBlue, LinearGradientMode.Vertical);
            g.FillRectangle(lgBrush, 300, 220, 70, 70);

            g.FillRectangle(Brushes.Indigo, 370, 220, 70, 70);

            sldBrush = new SolidBrush(Color.Orange);
            g.FillRectangle(sldBrush, 440, 220, 70, 70);

            lgBrush = new LinearGradientBrush(new RectangleF(0, 0, 90, 90), Color.BlueViolet, Color.LightPink, LinearGradientMode.BackwardDiagonal);

            g.FillRectangle(lgBrush, 300, 290, 70, 70);

            TextureBrush tBrush = new TextureBrush(Image.FromFile(@"Images\csharp.jpg"));
            g.FillRectangle(tBrush, 370, 290, 70, 70);

            tBrush = new TextureBrush(Image.FromFile(@"Images\003.jpg"));
            g.FillRectangle(tBrush, 440, 290, 70, 70);
        }
开发者ID:xs2ranjeet,项目名称:13ns9-1spr,代码行数:30,代码来源:Cub.cs


示例3: DrawBackgroundImage

 public static void DrawBackgroundImage(Graphics g, Image backgroundImage, Color backColor, ImageLayout backgroundImageLayout, Rectangle bounds, Rectangle clipRect, Point scrollOffset, RightToLeft rightToLeft)
 {
     if (g == null)
     {
         throw new ArgumentNullException("g");
     }
     if (backgroundImageLayout == ImageLayout.Tile)
     {
         using (TextureBrush brush = new TextureBrush(backgroundImage, WrapMode.Tile))
         {
             if (scrollOffset != Point.Empty)
             {
                 Matrix transform = brush.Transform;
                 transform.Translate((float) scrollOffset.X, (float) scrollOffset.Y);
                 brush.Transform = transform;
             }
             g.FillRectangle(brush, clipRect);
             return;
         }
     }
     Rectangle rect = CalculateBackgroundImageRectangle(bounds, backgroundImage, backgroundImageLayout);
     if ((rightToLeft == RightToLeft.Yes) && (backgroundImageLayout == ImageLayout.None))
     {
         rect.X += clipRect.Width - rect.Width;
     }
     using (SolidBrush brush2 = new SolidBrush(backColor))
     {
         g.FillRectangle(brush2, clipRect);
     }
     if (!clipRect.Contains(rect))
     {
         if ((backgroundImageLayout == ImageLayout.Stretch) || (backgroundImageLayout == ImageLayout.Zoom))
         {
             rect.Intersect(clipRect);
             g.DrawImage(backgroundImage, rect);
         }
         else if (backgroundImageLayout == ImageLayout.None)
         {
             rect.Offset(clipRect.Location);
             Rectangle destRect = rect;
             destRect.Intersect(clipRect);
             Rectangle rectangle3 = new Rectangle(Point.Empty, destRect.Size);
             g.DrawImage(backgroundImage, destRect, rectangle3.X, rectangle3.Y, rectangle3.Width, rectangle3.Height, GraphicsUnit.Pixel);
         }
         else
         {
             Rectangle rectangle4 = rect;
             rectangle4.Intersect(clipRect);
             Rectangle rectangle5 = new Rectangle(new Point(rectangle4.X - rect.X, rectangle4.Y - rect.Y), rectangle4.Size);
             g.DrawImage(backgroundImage, rectangle4, rectangle5.X, rectangle5.Y, rectangle5.Width, rectangle5.Height, GraphicsUnit.Pixel);
         }
     }
     else
     {
         ImageAttributes imageAttr = new ImageAttributes();
         imageAttr.SetWrapMode(WrapMode.TileFlipXY);
         g.DrawImage(backgroundImage, rect, 0, 0, backgroundImage.Width, backgroundImage.Height, GraphicsUnit.Pixel, imageAttr);
         imageAttr.Dispose();
     }
 }
开发者ID:zhushengwen,项目名称:example-zhushengwen,代码行数:60,代码来源:CmbControlPaintEx.cs


示例4: OnPaint

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            Graphics G = e.Graphics;
            //利用位图作为纹理创建纹理画刷
            TextureBrush textureBrush1 = new TextureBrush(Properties.Resources.test);
            G.FillRectangle(textureBrush1, 40, 0, 40, 120);
            G.FillRectangle(textureBrush1, 0, 40, 120, 40);
            //利用位置的指定区域作为纹理创建纹理画刷
            TextureBrush textureBrush2 = new TextureBrush(Properties.Resources.test, new Rectangle(10, 10, 28, 28));
            G.FillRectangle(textureBrush2, 180, 0, 40, 120);
            G.FillRectangle(textureBrush2, 140, 40, 120, 40);
            TextureBrush textureBrush3 = new TextureBrush(Properties.Resources.test, new Rectangle(10, 10, 28, 28));
            textureBrush3.WrapMode = WrapMode.TileFlipXY;           //设置纹理图像的渐变方式
            G.FillRectangle(textureBrush3, 30, 140, 60, 120);
            G.FillRectangle(textureBrush3, 0, 170, 120, 60);
            float[][] newColorMatrix = new float[][]{               //颜色变换矩形
            new float[]{0.2f,0,0,0,0},                          //红色分量
            new float[]{0,0.6f,0,0,0},                          //绿色分量
            new float[]{0,0,0.2f,0,0},                          //蓝色分量
            new float[]{0,0,0,0.5f,0},                          //透明度分量
            new float[]{0,0,0,0,1}};                            //始终为1
            ColorMatrix colorMatrix = new ColorMatrix(newColorMatrix);
            ImageAttributes imageAttributes = new ImageAttributes();
            imageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
            TextureBrush textureBrush4 = new TextureBrush(Properties.Resources.test, new Rectangle(0, 0, 48, 48), imageAttributes);
            textureBrush4.WrapMode = WrapMode.TileFlipXY;
            G.FillRectangle(textureBrush4, 170, 140, 60, 120);
            G.FillRectangle(textureBrush4, 140, 170, 120, 60);
            textureBrush1.Dispose();                                //释放画刷
            textureBrush2.Dispose();                                //释放画刷
            textureBrush3.Dispose();                                //释放画刷
            textureBrush4.Dispose();                                //释放画刷
        }
开发者ID:dalinhuang,项目名称:wdeqawes-efrwserd-rgtedrtf,代码行数:35,代码来源:FormTextureBrush.cs


示例5: OnHtmlLabelHostingPanelPaint

 private void OnHtmlLabelHostingPanelPaint(object sender, PaintEventArgs e)
 {
     using (var b = new TextureBrush(_background, WrapMode.Tile))
     {
         e.Graphics.FillRectangle(b, _htmlLabelHostingPanel.ClientRectangle);
     }
 }
开发者ID:CapitalCoder,项目名称:HTML-Renderer,代码行数:7,代码来源:SampleForm.cs


示例6: cropAtRect

        public static Bitmap cropAtRect(Bitmap bi, int size)
        {
            Bitmap btm = new Bitmap(bi.Width + 4, bi.Height + 4);
            Bitmap btm2 = new Bitmap(size + 5, size + 5);

            using (Graphics grf = Graphics.FromImage(bi))
            {
                using (Brush brsh = new SolidBrush(Color.FromArgb(120, 0, 0, 0)))
                {
                    grf.FillRectangle(brsh, new System.Drawing.Rectangle(0, 0, bi.Width, bi.Height));
                }
            }
            using (Graphics grf = Graphics.FromImage(btm))
            {
                using (Brush brsh = new SolidBrush(Color.Red))
                {
                    grf.FillEllipse(brsh, 2, 2, bi.Width - 4, bi.Height - 4);
                }
                using (Brush brsh = new TextureBrush(bi))
                {

                    grf.FillEllipse(brsh, 6, 6, bi.Width - 12, bi.Height - 12);
                }
            }
            using (Graphics grf = Graphics.FromImage(btm2))
            {
                grf.InterpolationMode = InterpolationMode.High;
                grf.CompositingQuality = CompositingQuality.HighQuality;
                grf.SmoothingMode = SmoothingMode.AntiAlias;
                grf.DrawImage(btm, new System.Drawing.Rectangle(0, 0, size, size));
            }

            return btm2;
        }
开发者ID:KoalaHuman,项目名称:EloBuddy-2,代码行数:34,代码来源:Util.cs


示例7: MainForm

        public MainForm()
        {
            InitializeComponent();

            this.currentFileData = new GameData(32, 32);
            this.currentFileName = null;

            this.toolImages = new TextureBrush[7];

            for (int i = 0; i < this.toolImages.Length; i++)
            {
                this.toolImages[i] = new TextureBrush(Image.FromFile("images/" + i + ".png"));
            }

            this.backgroundImage = new TextureBrush(Image.FromFile("images/checkerboard.png"));

            this.selectedTool = 1;

            this.graphicsContext = BufferedGraphicsManager.Current;
            this.graphics = graphicsContext.Allocate(this.StageEditBoard.CreateGraphics(),
                new Rectangle(0, 0, 32 * (int)EDIT_BOARD_SCALING, 32 * (int)EDIT_BOARD_SCALING));

            for(int i = 0; i < MainForm.DIRECTIONS.Length; i++)
                this.StartDirection.Items.Add(DIRECTIONS[i]);

            this.LoadTextureFiles();

            this.FileNew(null, null);
        }
开发者ID:erbuka,项目名称:andrea,代码行数:29,代码来源:MainForm.cs


示例8: GetCircleBitmap

        public Image GetCircleBitmap(Size size, Color col)
        {
            Bitmap bmp2 = new Bitmap(size.Width, size.Height);

            using (Bitmap bmp = new Bitmap(size.Width, size.Height))
            {
                using (Graphics g = Graphics.FromImage(bmp))
                {
                    g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                    g.Clear(col);
                }

                using (TextureBrush t = new TextureBrush(bmp))
                {
                    using (Graphics g = Graphics.FromImage(bmp2))
                    {
                        g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

                        g.FillEllipse(t, 0, 0, bmp2.Width, bmp2.Height);
                    }
                }
            }

            return bmp2;
        }
开发者ID:rahulbishnoi,项目名称:LabM,代码行数:25,代码来源:ColorHelper.cs


示例9: CopyIrregularAreaFromBitmap

        //Other methods to copy, color fill or filter found objects
        public Bitmap CopyIrregularAreaFromBitmap(Bitmap source, List<Point> points, Color bg_color)
        {
            Bitmap copiedImg = new Bitmap(source);
            using (Graphics gr = Graphics.FromImage(copiedImg))
            {
                // Set the background color.
                gr.Clear(bg_color);

                // Make a brush out of the original image.
                using (Brush br = new TextureBrush(source))
                {
                    // Fill the selected area with the brush.
                    gr.FillPolygon(br, points.ToArray());

                    // Find the bounds of the selected area.
                    Rectangle source_rect = GetPointListBounds(points);

                    // Make a bitmap that only holds the selected area.
                    Bitmap result = new Bitmap(
                        source_rect.Width, source_rect.Height);

                    // Copy the selected area to the result bitmap.
                    using (Graphics result_gr = Graphics.FromImage(result))
                    {
                        Rectangle dest_rect = new Rectangle(0, 0,
                            source_rect.Width, source_rect.Height);
                        result_gr.DrawImage(copiedImg, dest_rect,
                            source_rect, GraphicsUnit.Pixel);
                    }

                    // Return the result.
                    return result;
                }
            }
        }
开发者ID:AndriiGro,项目名称:imageRecognitionDiploma,代码行数:36,代码来源:Form1.cs


示例10: GetBrush

 public TextureBrush GetBrush(Matrix matrix)
 {
     Bitmap bmp;
     if (_context2D != null)
     {
         bmp = _context2D.GetBitmap();
     }
     else
     {
         bmp = new Bitmap(_imagePath);
     }
     WrapMode wm = WrapMode.Tile;
     switch (_repetition)
     {
         case "repeat":
             wm = WrapMode.Tile;
             break;
         case "no-repeat":
             wm = WrapMode.Clamp;
             break;
         case "repeat-x":
             wm = WrapMode.TileFlipX;
             break;
         case "repeat-y":
             wm = WrapMode.TileFlipY;
             break;
     }
     var brush = new TextureBrush(bmp, wm);
     brush.MultiplyTransform(matrix);
     return brush;
 }
开发者ID:podlipensky,项目名称:sharpcanvas,代码行数:31,代码来源:CanvasPattern.cs


示例11: Create

      public Image Create( string text )
      {
         var bitmap = (Bitmap) Image.FromFile( "Stone08Small.png" );

         using ( var g = Graphics.FromImage( bitmap ) )
         {
            g.SmoothingMode = SmoothingMode.HighQuality;
            g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;

            using ( var textureBitmap = Image.FromFile( "Stone11Small.png" ) )
            {
               var textureBrush = new TextureBrush( textureBitmap );

               using ( var font = new Font( "Book Antiqua", 84 ) )
               {
                  var textSize = g.MeasureString( text, font );

                  float x = ( _decalSize - textSize.Width ) / 2;
                  float y = ( _decalSize - textSize.Height ) / 2;

                  g.DrawString( text, font, textureBrush, x, y );
               }
            }
         }

         return bitmap;
      }
开发者ID:alexwnovak,项目名称:TF2Maps,代码行数:27,代码来源:DecalGenerator.cs


示例12: draw

        public override void draw(Graphics g)
        {
            TextureBrush texture = new TextureBrush(image1);
            texture.WrapMode = System.Drawing.Drawing2D.WrapMode.Tile;

            g.FillEllipse(texture, Rectangle.Round(base.loc));
        }
开发者ID:K-4U,项目名称:ese_project4y5,代码行数:7,代码来源:drawTable.cs


示例13: Form1_Paint

        private void Form1_Paint(object sender, PaintEventArgs e)
        {

            LinearGradientBrush linearBrush = new LinearGradientBrush(drawArea(new Rectangle(5, 35, 30, 100)), Color.Yellow, Color.Yellow, LinearGradientMode.ForwardDiagonal);
            graphicsObject(e).FillEllipse(linearBrush, this.Width / 4, 10, 300, 300);

            LinearGradientBrush linearBrush2 = new LinearGradientBrush(drawArea(new Rectangle(5, 35, 30, 100)), Color.Black, Color.Black, LinearGradientMode.Horizontal);
            graphicsObject(e).FillEllipse(linearBrush2, 190, 60, 100, 100);

            LinearGradientBrush linearBrush3 = new LinearGradientBrush(drawArea(new Rectangle(5, 35, 30, 100)), Color.Black, Color.Black, LinearGradientMode.BackwardDiagonal);
            graphicsObject(e).FillEllipse(linearBrush3, 330, 60, 100, 100);

            LinearGradientBrush linearBrush4 = new LinearGradientBrush(drawArea(new Rectangle(5, 35, 30, 100)), Color.Yellow, Color.Yellow, LinearGradientMode.BackwardDiagonal);
            graphicsObject(e).FillEllipse(linearBrush4, 460, 400, 100, 100);

            Bitmap textureBitmap = new Bitmap(10, 10);
            Graphics graphicsObject2 = Graphics.FromImage(textureBitmap);

            SolidBrush solidColorBrush = new SolidBrush(Color.Red);
            Pen coloredPen = new Pen(solidColorBrush);

            TextureBrush texturedBrush = new TextureBrush(textureBitmap);
            graphicsObject(e).FillRectangle(texturedBrush, 155, 30, 75, 100);

            coloredPen.Color = Color.Black;
            coloredPen.Width = 6;
            graphicsObject(e).DrawPie(coloredPen, 205, 220, 205, 10, 100, 100);
        }
开发者ID:michael1995,项目名称:C-Sharp-Projects,代码行数:28,代码来源:Form1.cs


示例14: OnPaint

 protected override void OnPaint(PaintEventArgs e)
 {
     base.OnPaint(e);
     using (var brush = new TextureBrush(gradient, WrapMode.TileFlipX))
     {
         e.Graphics.FillRectangle(brush, 0, 0, Width, gradient.Height);
     }
 }
开发者ID:nitrocaster,项目名称:ListPlayers,代码行数:8,代码来源:HorizontalPanel.cs


示例15: Form1_Paint

 private void Form1_Paint(object sender, PaintEventArgs e)
 {
     Image I = Image.FromFile("클로버.jpg");
     TextureBrush B = new TextureBrush(I);
     //TextureBrush B = new TextureBrush(I, WrapMode.TileFlipX);
     //TextureBrush B = new TextureBrush(I, WrapMode.TileFlipY);
     e.Graphics.FillRectangle(B, ClientRectangle);
 }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:8,代码来源:Form1.cs


示例16: TextureForm

		public TextureForm (string[] args)
		{
			filename = args.Length > 0 ? args [1] : String.Empty;

			InitializeComponent ();

			tb = new TextureBrush (pictureBox1.Image);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:texture.cs


示例17: drawTile

        public void drawTile(Graphics paper, int x, int y, int width, int height)
        {
            paper.DrawRectangle(new Pen(Color.Black), x, y, width, height);

            TextureBrush b1 = new TextureBrush(image);

            paper.FillRectangle(b1, x, y, width, height);
        }
开发者ID:CHK36,项目名称:GovHack,代码行数:8,代码来源:Tile.cs


示例18: Form1_Paint

 private void Form1_Paint(object sender, PaintEventArgs e)
 {
     Image I = Image.FromFile("인형.jpg");
     TextureBrush B = new TextureBrush(I);
     B.Transform = new Matrix(1, 0, 0, 1, 50, 50);
     e.Graphics.FillRectangle(B, 50, 50,
         ClientRectangle.Right, ClientRectangle.Bottom);
 }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:8,代码来源:Form1.cs


示例19: DrawTiled

 public static void DrawTiled(this Graphics g, int x, int y, int width, int height, Image image)
 {
     var r = new Rectangle(x, y, width, height);
     using (var b = new TextureBrush(image))
     {
         g.FillRectangle(b, r);
     }
 }
开发者ID:foobit,项目名称:PICO8Tool,代码行数:8,代码来源:GraphicsExtensions.cs


示例20: GeneratePattern

        public static void GeneratePattern()
        {
            Bitmap bmpPattern = new Bitmap(20,20, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            Graphics g = Graphics.FromImage(bmpPattern);
            g.FillRectangle(new SolidBrush(Color.FromArgb(255, 255, 255)), 0, 0, bmpPattern.Width / 2, bmpPattern.Height / 2);
            g.FillRectangle(new SolidBrush(Color.FromArgb(255, 255, 255)), bmpPattern.Width / 2, bmpPattern.Height / 2, bmpPattern.Width / 2, bmpPattern.Height / 2);

            _texture = new TextureBrush(bmpPattern);
        }
开发者ID:timdetering,项目名称:Endogine,代码行数:9,代码来源:BackgroundPattern.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Design.PaintValueEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Drawing.StringFormat类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap