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


C# Brush.Clone方法代码示例

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


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

示例1: Pen

 public Pen(Brush brush, float width)
 {
     if (brush == null)
         throw new ArgumentNullException ("brush");
     this.brush = (Brush) brush.Clone ();
     var sb = brush as SolidBrush;
     if (sb != null)
         color = sb.Color;
 }
开发者ID:xerxesb,项目名称:sysdrawing-coregraphics,代码行数:9,代码来源:Pen.cs

示例2: Pen

		public Pen (Brush brush, float width)
		{
			_brush = (Brush)brush.Clone();;
			_width = width;
			_dashStyle = DashStyle.Solid;
			_startCap = LineCap.Flat;
			_dashCap = DashCap.Flat;
			_endCap = LineCap.Flat;
			_alignment = PenAlignment.Center;
			_lineJoin = LineJoin.Miter;
			_miterLimit = 10f;
			_transform = new Matrix();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:13,代码来源:Pen.jvm.cs

示例3: Fill

 /// <summary>
 /// Constructor that creates a <see cref="Brush"/> fill, using a user-supplied, custom
 /// <see cref="Brush"/>.  This constructor will make the brush unscaled (see <see cref="IsScaled"/>),
 /// but it provides <see paramref="alignH"/> and <see paramref="alignV"/> parameters to control
 /// alignment of the brush with respect to the filled object.
 /// </summary>
 /// <param name="brush">The <see cref="Brush"/> to use for fancy fills.  Typically, this would
 /// be a <see cref="LinearGradientBrush"/> or a <see cref="TextureBrush"/> class</param>
 /// <param name="alignH">Controls the horizontal alignment of the brush within the filled object
 /// (see <see cref="AlignH"/></param>
 /// <param name="alignV">Controls the vertical alignment of the brush within the filled object
 /// (see <see cref="AlignV"/></param>
 public Fill( Brush brush, AlignH alignH, AlignV alignV )
 {
     Init();
     _alignH = alignH;
     _alignV = alignV;
     _isScaled = false;
     _color = Color.White;
     _brush = (Brush) brush.Clone();
     _type = FillType.Brush;
 }
开发者ID:kjburns31,项目名称:vixen-modules,代码行数:22,代码来源:Fill.cs

示例4: ScaleBrush

        private Brush ScaleBrush( RectangleF rect, Brush brush, bool isScaled )
        {
            if ( brush != null )
            {
                if ( brush is SolidBrush )
                {
                    return (Brush) brush.Clone();
                }
                else if ( brush is LinearGradientBrush )
                {
                    LinearGradientBrush linBrush = (LinearGradientBrush) brush.Clone();

                    if ( isScaled )
                    {
                        linBrush.ScaleTransform( rect.Width / linBrush.Rectangle.Width,
                            rect.Height / linBrush.Rectangle.Height, MatrixOrder.Append );
                        linBrush.TranslateTransform( rect.Left - linBrush.Rectangle.Left,
                            rect.Top - linBrush.Rectangle.Top, MatrixOrder.Append );
                    }
                    else
                    {
                        float	dx = 0,
                                dy = 0;
                        switch ( _alignH )
                        {
                        case AlignH.Left:
                            dx = rect.Left - linBrush.Rectangle.Left;
                            break;
                        case AlignH.Center:
                            dx = ( rect.Left + rect.Width / 2.0F ) - linBrush.Rectangle.Left;
                            break;
                        case AlignH.Right:
                            dx = ( rect.Left + rect.Width ) - linBrush.Rectangle.Left;
                            break;
                        }

                        switch ( _alignV )
                        {
                        case AlignV.Top:
                            dy = rect.Top - linBrush.Rectangle.Top;
                            break;
                        case AlignV.Center:
                            dy = ( rect.Top + rect.Height / 2.0F ) - linBrush.Rectangle.Top;
                            break;
                        case AlignV.Bottom:
                            dy = ( rect.Top + rect.Height) - linBrush.Rectangle.Top;
                            break;
                        }

                        linBrush.TranslateTransform( dx, dy, MatrixOrder.Append );
                    }

                    return linBrush;

                } // LinearGradientBrush
                else if ( brush is TextureBrush )
                {
                    TextureBrush texBrush = (TextureBrush) brush.Clone();

                    if ( isScaled )
                    {
                        texBrush.ScaleTransform( rect.Width / texBrush.Image.Width,
                            rect.Height / texBrush.Image.Height, MatrixOrder.Append );
                        texBrush.TranslateTransform( rect.Left, rect.Top, MatrixOrder.Append );
                    }
                    else
                    {
                        float	dx = 0,
                                dy = 0;
                        switch ( _alignH )
                        {
                        case AlignH.Left:
                            dx = rect.Left;
                            break;
                        case AlignH.Center:
                            dx = ( rect.Left + rect.Width / 2.0F );
                            break;
                        case AlignH.Right:
                            dx = ( rect.Left + rect.Width );
                            break;
                        }

                        switch ( _alignV )
                        {
                        case AlignV.Top:
                            dy = rect.Top;
                            break;
                        case AlignV.Center:
                            dy = ( rect.Top + rect.Height / 2.0F );
                            break;
                        case AlignV.Bottom:
                            dy = ( rect.Top + rect.Height);
                            break;
                        }

                        texBrush.TranslateTransform( dx, dy, MatrixOrder.Append );
                    }

                    return texBrush;
                }
//.........这里部分代码省略.........
开发者ID:kjburns31,项目名称:vixen-modules,代码行数:101,代码来源:Fill.cs

示例5: Fill

 /// <summary>
 /// Constructor that creates a <see cref="Brush"/> fill, using a user-supplied, custom
 /// <see cref="Brush"/>.  This constructor will make the brush unscaled (see <see cref="IsScaled"/>),
 /// but it provides <see paramref="alignH"/> and <see paramref="alignV"/> parameters to control
 /// alignment of the brush with respect to the filled object.
 /// </summary>
 /// <param name="brush">The <see cref="Brush"/> to use for fancy fills.  Typically, this would
 /// be a <see cref="LinearGradientBrush"/> or a <see cref="TextureBrush"/> class</param>
 /// <param name="alignH">Controls the horizontal alignment of the brush within the filled object
 /// (see <see cref="AlignH"/></param>
 /// <param name="alignV">Controls the vertical alignment of the brush within the filled object
 /// (see <see cref="AlignV"/></param>
 public Fill( Brush brush, AlignH alignH, AlignV alignV )
 {
     Init();
     this.alignH = alignH;
     this.alignV = alignV;
     this.isScaled = false;
     this.color = Color.White;
     this.brush = (Brush) brush.Clone();
     this.type = FillType.Brush;
 }
开发者ID:InsungChoi,项目名称:dddd,代码行数:22,代码来源:Fill.cs

示例6: VGElement

 /// <summary>
 /// Initializes a new instance of the VGElement class.
 /// </summary>
 /// <param name="newShapeDrawAction">Drawing action: Edge, Fill, Both</param>
 /// <param name="newBrush">Brush for text and fills</param>
 /// <param name="newFont">Font for text</param>
 /// <param name="newFontColor">Color for text</param>
 /// <param name="newBounds">Bounds of element</param>
 /// <param name="newStyleGroup">Group Enumeration, <see cref="VGStyleGroup"/></param>
 /// <param name="newName">Name of Element</param>
 /// <param name="newElementGroup">Element group description</param>
 public VGElement(
   ShapeDrawAction newShapeDrawAction,
   Brush newBrush,
   Font newFont,
   Color newFontColor,
   RectangleF newBounds,
   VGStyleGroup newStyleGroup,
   string newName,
   string newElementGroup)
 {
   this.InitStandards();
   this.styleGroup = newStyleGroup;
   this.name = newName;
   this.elementGroup = newElementGroup;
   this.shapeDrawAction = newShapeDrawAction;
   this.Brush = newBrush == null ? null : (Brush)newBrush.Clone();
   this.Font = newFont == null ? null : (Font)newFont.Clone();
   this.FontColor = newFontColor;
   this.Bounds = newBounds;
 }
开发者ID:DeSciL,项目名称:Ogama,代码行数:31,代码来源:VGElement.cs

示例7: Fill

 /// <summary>
 /// Initializes a new instance of the <see cref="Fill"/> class. 
 /// Constructor that creates a <see cref="Brush"/> fill, using a user-supplied, custom
 /// <see cref="Brush"/>.  The brush will be scaled to fit the destination screen object according to the <see paramref="isScaled"/> parameter.
 /// </summary>
 /// <param name="brush">
 /// The <see cref="Brush"/> to use for fancy fills.  Typically, this would be a <see cref="LinearGradientBrush"/> or a
 /// <see cref="TextureBrush"/> class
 /// </param>
 /// <param name="isScaled">
 /// Determines if the brush will be scaled to fit the bounding box of the destination object.  true to scale it, false to leave it
 /// unscaled
 /// </param>
 public Fill(Brush brush, bool isScaled)
 {
     this.Init();
     this._isScaled = isScaled;
     this._color = Color.White;
     this._brush = (Brush)brush.Clone();
     this._type = FillType.Brush;
 }
开发者ID:tu-tran,项目名称:FareLiz,代码行数:21,代码来源:Fill.cs

示例8: RenderThread

        /// <summary>
        /// The constructor for the RenderThread. Sets up the private members
        /// of the class, but DOES NOT start the rendering process.
        /// </summary>
        /// @param metrics The MapMetrics object for this Map
        /// @param features The VectorFeature array
        /// @param type The type of shapefile we're going to draw
        /// @param beginning The array index of the VectorFeature to begin drawing with
        /// @param ending The array index of the VectorFeature to end drawing with
        /// @param pen The pen to draw the features with
        /// @param brush The brush to fill the features with
        public RenderThread( MapMetrics metrics, 
							 VectorFeature[] features,
							 ShapeType type,
							 int beginning,
							 int ending,
							 Pen pen,
							 Brush brush )
        {
            _mapMetrics = metrics;
            _features = features;
            _shapeType = type;
            _beginningFeature = beginning;
            _endingFeature = ending;
            _pen = (Pen) pen.Clone();
            _brush = (Brush) brush.Clone();
            _gr = Graphics.FromImage( _mapMetrics.Canvas );
        }
开发者ID:johnvcoleman,项目名称:ShapeDotNet,代码行数:28,代码来源:GIS.ShapefileReader.RenderThread.cs


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