System.Drawing.Drawing2D.LinearGradientBrush.SetBlendTriangularShape C# (CSharp) Method

SetBlendTriangularShape() public method

public SetBlendTriangularShape ( float focus ) : void
focus float
return void
        public void SetBlendTriangularShape(float focus)
        {
            SetBlendTriangularShape (focus, 1.0F);
        }

Same methods

LinearGradientBrush::SetBlendTriangularShape ( float focus, float scale ) : void

Usage Example

コード例 #1
0
        /// <summary> Method is called whenever this form is resized. </summary>
        /// <param name="e"></param>
        /// <remarks> This redraws the background of this form </remarks>
        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);

            // Get rid of any current background image
            if (BackgroundImage != null)
            {
                BackgroundImage.Dispose();
                BackgroundImage = null;
            }

            if (ClientSize.Width > 0)
            {
                // Create the items needed to draw the background
                Bitmap image = new Bitmap(ClientSize.Width, ClientSize.Height);
                Graphics gr = Graphics.FromImage(image);
                Rectangle rect = new Rectangle(new Point(0, 0), ClientSize);

                // Create the brush
                LinearGradientBrush brush = new LinearGradientBrush(rect, SystemColors.Control, ControlPaint.Dark(SystemColors.Control), LinearGradientMode.Vertical);
                brush.SetBlendTriangularShape(0.33F);

                // Create the image
                gr.FillRectangle(brush, rect);
                gr.Dispose();

                // Set this as the backgroundf
                BackgroundImage = image;
            }
        }
All Usage Examples Of System.Drawing.Drawing2D.LinearGradientBrush::SetBlendTriangularShape