當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。