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


C# LinearGradientBrush.SetBlendTriangularShape方法代码示例

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


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

示例1: OnResize

        /// <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;
            }
        }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:33,代码来源:Aggregation_Space_Used_Form.cs

示例2: DrawSector

		private void DrawSector(Graphics g, PointF center, PointF p1, PointF p2, Color innerColor, Color outerColor) {
			GraphicsPath pt = new GraphicsPath();
			pt.AddLine(p1, center);
			pt.AddLine(center, p2);
			LinearGradientBrush lgb = new LinearGradientBrush( GetVertical(center, p1, p2) , center, outerColor, innerColor );
			if (_triangularShape)
				lgb.SetBlendTriangularShape(0.5f);
			g.FillPath( lgb, pt );
		}
开发者ID:GirlD,项目名称:mono,代码行数:9,代码来源:PathGradientBrush.jvm.cs

示例3: PraysTimes_Paint

        private void PraysTimes_Paint(object sender, PaintEventArgs e)
        {

            using (GraphicsPath Path = new GraphicsPath())
            {
                
                using (LinearGradientBrush lgb = new LinearGradientBrush(ClientRectangle,
                   Properties.Settings.Default.panelMoveColorLight,
                   Properties.Settings.Default.panelMoveColorDark, 90, true))
                {
                    lgb.SetBlendTriangularShape(0.5f);
                    Path.AddArc(0, 0, 30, 30, 180, 90);
                    Path.AddArc(this.ClientRectangle.Width - 30, 0, 30, 30, 270, 90);
                    Path.AddArc(this.ClientRectangle.Width - 30, this.ClientRectangle.Height - 30, 30, 30, 360, 90);
                    Path.AddArc(0, this.ClientRectangle.Height - 30, 30, 30, 90, 90);
                    this.Region = new Region(Path);
                    
                    e.Graphics.FillRegion(lgb, this.Region);
                }
            }
            
        }
开发者ID:sadig41,项目名称:Media_Player,代码行数:22,代码来源:PraysTimes.cs

示例4: SetBlendTriangularShape_Scale

		public void SetBlendTriangularShape_Scale ()
		{
			LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
			// max valid
			lgb.SetBlendTriangularShape (0, 1);
			Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity-1");
			// min valid
			lgb.SetBlendTriangularShape (1, 0);
			Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity-1");
			// middle
			lgb.SetBlendTriangularShape (0.5f, 0.5f);
			Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity-1");
			// no impact on matrix
		}
开发者ID:nlhepler,项目名称:mono,代码行数:14,代码来源:LinearGradientBrushTest.cs

示例5: Rectangle

		public void Rectangle ()
		{
			LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
			CheckDefaultRectangle ("Original", lgb.Rectangle);
			lgb.MultiplyTransform (new Matrix (2, 0, 0, 2, 2, 2));
			CheckDefaultRectangle ("Multiply", lgb.Rectangle);
			lgb.ResetTransform ();
			CheckDefaultRectangle ("Reset", lgb.Rectangle);
			lgb.RotateTransform (90);
			CheckDefaultRectangle ("Rotate", lgb.Rectangle);
			lgb.ScaleTransform (4, 0.25f);
			CheckDefaultRectangle ("Scale", lgb.Rectangle);
			lgb.TranslateTransform (-10, -20);
			CheckDefaultRectangle ("Translate", lgb.Rectangle);

			lgb.SetBlendTriangularShape (0.5f);
			CheckDefaultRectangle ("SetBlendTriangularShape", lgb.Rectangle);
			lgb.SetSigmaBellShape (0.5f);
			CheckDefaultRectangle ("SetSigmaBellShape", lgb.Rectangle);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:20,代码来源:LinearGradientBrushTest.cs

示例6: CreatePaintElements

        private void CreatePaintElements()
        {
            DisposeBrushes();

            switch (mGradientStyle)
            {
                case GradientMode.VerticalCenter:

                    mSteepRect1 = new Rectangle(
                        0,
                        2,
                        mSteepWidth,
                        this.Height / 2 + (int)(this.Height * 0.05));
                    mBrush1 = new LinearGradientBrush(mSteepRect1, mColor1, mColor2, LinearGradientMode.Vertical);

                    mSteepRect2 = new Rectangle(
                        0,
                        mSteepRect1.Bottom - 1,
                        mSteepWidth,
                        this.Height - mSteepRect1.Height - 4);
                    mBrush2 = new LinearGradientBrush(mSteepRect2, mColor2, mColor1, LinearGradientMode.Vertical);
                    break;

                case GradientMode.Vertical:
                    mSteepRect1 = new Rectangle(
                        0,
                        3,
                        mSteepWidth,
                        this.Height - 7);
                    mBrush1 = new LinearGradientBrush(mSteepRect1, mColor1, mColor2, LinearGradientMode.Vertical);
                    mSteepRect2 = new Rectangle(
                        -100,
                        -100,
                        1,
                        1);
                    mBrush2 = new LinearGradientBrush(mSteepRect2, mColor2, mColor1, LinearGradientMode.Horizontal);
                    break;


                case GradientMode.Horizontal:
                    mSteepRect1 = new Rectangle(
                        0,
                        3,
                        mSteepWidth,
                        this.Height - 7);

                    //					mBrush1 = new LinearGradientBrush(rTemp, mColor1, mColor2, LinearGradientMode.Horizontal);
                    mBrush1 = new LinearGradientBrush(this.ClientRectangle, mColor1, mColor2, LinearGradientMode.Horizontal);
                    mSteepRect2 = new Rectangle(
                        -100,
                        -100,
                        1,
                        1);
                    mBrush2 = new LinearGradientBrush(mSteepRect2, Color.Red, Color.Red, LinearGradientMode.Horizontal);
                    break;


                case GradientMode.HorizontalCenter:
                    mSteepRect1 = new Rectangle(
                        0,
                        3,
                        mSteepWidth,
                        this.Height - 7);
                    //					mBrush1 = new LinearGradientBrush(rTemp, mColor1, mColor2, LinearGradientMode.Horizontal);
                    mBrush1 = new LinearGradientBrush(this.ClientRectangle, mColor1, mColor2, LinearGradientMode.Horizontal);
                    mBrush1.SetBlendTriangularShape(0.5f);

                    mSteepRect2 = new Rectangle(
                        -100,
                        -100,
                        1,
                        1);
                    mBrush2 = new LinearGradientBrush(mSteepRect2, Color.Red, Color.Red, LinearGradientMode.Horizontal);
                    break;


                case GradientMode.Diagonal:
                    mSteepRect1 = new Rectangle(
                        0,
                        3,
                        mSteepWidth,
                        this.Height - 7);
                    //					mBrush1 = new LinearGradientBrush(rTemp, mColor1, mColor2, LinearGradientMode.ForwardDiagonal);
                    mBrush1 = new LinearGradientBrush(this.ClientRectangle, mColor1, mColor2, LinearGradientMode.ForwardDiagonal);
                    //					((LinearGradientBrush) mBrush1).SetBlendTriangularShape(0.5f);

                    mSteepRect2 = new Rectangle(
                        -100,
                        -100,
                        1,
                        1);
                    mBrush2 = new LinearGradientBrush(mSteepRect2, Color.Red, Color.Red, LinearGradientMode.Horizontal);
                    break;

                default:
                    mBrush1 = new LinearGradientBrush(mSteepRect1, mColor1, mColor2, LinearGradientMode.Vertical);
                    mBrush2 = new LinearGradientBrush(mSteepRect2, mColor2, mColor1, LinearGradientMode.Vertical);
                    break;

            }
//.........这里部分代码省略.........
开发者ID:Donnie888,项目名称:LxServer,代码行数:101,代码来源:LRProgressBar.cs

示例7: drawGlassButton

        private void drawGlassButton(Graphics g, RectangleF bounds, int opacity)
        {
            // initial bounds
            bounds.Inflate(-1, -1);
            // draw using anti alias
            using (GraphicsMode mode = new GraphicsMode(g, SmoothingMode.AntiAlias))
            {
                // draw the border around the button
                using (GraphicsPath buttonPath = createRoundRectanglePath(
                    g,
                    bounds.X, bounds.Y,
                    bounds.Width, bounds.Height,
                    1f))
                {
                    using (LinearGradientBrush borderBrush = new LinearGradientBrush(
                        bounds,
                        Color.FromArgb(opacity * 20, ButtonGradientEnd),
                        Color.FromArgb(opacity * 20, ButtonGradientBegin),
                        90f))
                    {
                        borderBrush.SetSigmaBellShape(0.5f);
                        using (Pen borderPen = new Pen(borderBrush, .5f))
                            g.DrawPath(borderPen, buttonPath);
                    }

                    // create a clipping region
                    RectangleF clipBounds = bounds;
                    clipBounds.Inflate(-1, -1);
                    using (GraphicsPath clipPath = createRoundRectanglePath(
                        g,
                        clipBounds.X, clipBounds.Y,
                        clipBounds.Width, clipBounds.Height,
                        1f))
                    {
                        using (Region region = new Region(clipPath))
                            g.SetClip(region, CombineMode.Exclude);
                    }

                    // fill in the edge accent
                    using (LinearGradientBrush edgeBrush = new LinearGradientBrush(
                        bounds,
                        Color.FromArgb(opacity * 15, ButtonBorderColor),
                        Color.FromArgb(opacity * 5, Color.Black),
                        90f))
                    {
                        edgeBrush.SetBlendTriangularShape(0.1f);
                        g.FillPath(edgeBrush, buttonPath);
                        g.ResetClip();
                        bounds.Inflate(-1, -1);
                    }

                    // fill the button with a subtle glow
                    using (LinearGradientBrush fillBrush = new LinearGradientBrush(
                        bounds,
                        Color.FromArgb(opacity * 10, Color.White),
                        Color.FromArgb(opacity * 5, ButtonGradientBegin),
                        LinearGradientMode.ForwardDiagonal))
                    {
                        fillBrush.SetBlendTriangularShape(0.4f);
                        g.FillPath(fillBrush, buttonPath);
                        g.ResetClip();
                    }
                }
            }
        }
开发者ID:Egoily,项目名称:CSharp-EAlbum,代码行数:65,代码来源:FaceRender.cs

示例8: drawLinearGradient

 private void drawLinearGradient(Rectangle rDmn, IntPtr hdc, LinearGradientMode m)
 {
     Graphics g = Graphics.FromHdc(hdc);
     float o = _fOpacity * 255;
     Color c1 = Color.FromArgb((int)o, _oGradientStartColor);
     Color c2 = Color.FromArgb((int)o, _oGradientEndColor);
     LinearGradientBrush hB = new LinearGradientBrush(
         rDmn,
         c1,
         c2,
         m);
     switch (_eGradientStyle)
     {
         case GradientStyle.VerticalTube:
             hB.SetBlendTriangularShape(.5f, 1.0f);
             g.FillRectangle(hB, rDmn);
             break;
         case GradientStyle.HorizontalTube:
             hB.SetBlendTriangularShape(.5f, 1.0f);
             g.FillRectangle(hB, rDmn);
             break;
         case GradientStyle.SigmaBellShape:
             hB.SetSigmaBellShape(.5f, 1.0f);
             g.FillRectangle(hB, rDmn);
             break;
         default:
             g.FillRectangle(hB, rDmn);
             break;
     }
     hB.Dispose();
     g.Dispose();
 }
开发者ID:JackWangCUMT,项目名称:winform-control-lib,代码行数:32,代码来源:WSNToolTip.cs

示例9: PaintView13

 void PaintView13(Graphics g)
 {
     // Create a rectangle
     Rectangle rect = new Rectangle(0, 0, 40, 20);
     // Create a linear gradient brush
     LinearGradientBrush rgBrush =
         new LinearGradientBrush(
             rect, Color.Black, Color.Blue,
             0.0f, true);
     // Fill rectangle
     g.FillRectangle(rgBrush,
                     new Rectangle(10, 10, 300, 100));
     // Set sigma bell shape
     rgBrush.SetSigmaBellShape(0.8f, 1.0f);
     // Fill rectangle again
     g.FillRectangle(rgBrush,
                     new Rectangle(10, 120, 300, 100));
     // Set blend triangular shape
     rgBrush.SetBlendTriangularShape(0.2f, 1.0f);
     // Fill rectangle again
     g.FillRectangle(rgBrush,
                     new Rectangle(10, 240, 300, 100));
 }
开发者ID:asfungithub,项目名称:sysdrawing-coregraphics,代码行数:23,代码来源:DrawingView.cs

示例10: OnPaint

        protected virtual void OnPaint(object sender, PaintEventArgs e)
        {

            if (m_Parent.WindowState != FormWindowState.Minimized)
            {

                e.Graphics.SmoothingMode = SmoothingMode.HighSpeed;
                top = new Rectangle(Border_Size, 0, m_Parent.ClientRectangle.Width - (Border_Size * 2),
                    Border_Size);

                rigt = new Rectangle(m_Parent.ClientRectangle.Width - Border_Size, Border_Size, Border_Size,
                    m_Parent.ClientRectangle.Height - (Border_Size * 2));
                bottom = new Rectangle(Border_Size,
                    m_Parent.ClientRectangle.Height - Border_Size, m_Parent.ClientRectangle.Width - (Border_Size * 2),
                    Border_Size);
                Left_Top = new Rectangle(0, 0, Border_Size, Border_Size);
                Left_B = new Rectangle(0, m_Parent.ClientRectangle.Height - Border_Size,
                    Border_Size, Border_Size);
                Panel_move = new Rectangle(Border_Size, Border_Size,
                    m_Parent.ClientRectangle.Width - (Border_Size * 2), Panel_Move_Size);
                if (controlBox)
                {
                    DrawCloseButtonNormal();
                    DrawMaxButtonNormal();
                    DrawMinButtonNormal();
                }






                Top_R = new Rectangle(m_Parent.ClientRectangle.Width - Border_Size, 0,
                    Border_Size, Border_Size);

                Right_B = new Rectangle(m_Parent.ClientRectangle.Width - Border_Size,
                    m_Parent.ClientRectangle.Height - Border_Size, Border_Size, Border_Size);

                left = new Rectangle(0, Border_Size, Border_Size, 
                    m_Parent.ClientRectangle.Height - (Border_Size * 2));
                LinearGradientBrush lgb_top = new LinearGradientBrush(top, this.Border_Top_light,
                    this.Border_Top_Dark, 90, true);
                LinearGradientBrush lgb_LR = new LinearGradientBrush(left, this.Border_LR_Dark,
                    this.Border_LR_light, 180, true);
                LinearGradientBrush lgb_Bottom = new LinearGradientBrush(bottom, this.Border_Bottom_light,
                    this.Border_Bottom_Dark, 90, true);
                LinearGradientBrush lgb_PanelMov = new LinearGradientBrush(Panel_move, this.Panel_Move_Dark,
                    this.Panel_Move_light, 90, true);
                lgb_PanelMov.SetBlendTriangularShape(0.5f);
                lgb_PanelMov.SetSigmaBellShape(0.5f);

                SizeF m_size = e.Graphics.MeasureString(this.Text, m_Font);
                SizeF mm_size  = e.Graphics.MeasureString(text, mm_font);

                ico = new Icon(m_Parent.Icon, 16, 16);
               
                e.Graphics.FillRectangle(lgb_LR, left);
                e.Graphics.FillRectangle(lgb_LR, rigt);
                e.Graphics.FillRectangle(lgb_LR, Left_Top);
                e.Graphics.FillRectangle(lgb_Bottom, Left_B);
                e.Graphics.FillRectangle(lgb_LR, Top_R);
                e.Graphics.FillRectangle(lgb_Bottom, Right_B);
                e.Graphics.FillRectangle(lgb_PanelMov, Panel_move);
                e.Graphics.FillRectangle(lgb_Bottom, bottom);
                e.Graphics.FillRectangle(lgb_top, top);
                rectClose = new Rectangle(m_Parent.ClientRectangle.Right - (bmp_Close.Width + 6),
                    (Panel_Move_Size + Border_Size - bmp_Close.Height) / 2, bmp_Close.Width, bmp_Close.Height);
                rectMax = new Rectangle(m_Parent.ClientRectangle.Right - (bmp_Close.Width + 8 + bmp_Max.Width),
                    ((Panel_Move_Size + Border_Size) - bmp_Max.Height) / 2, bmp_Max.Width, bmp_Max.Height);
                rectMin = new Rectangle(m_Parent.ClientRectangle.Right - (bmp_Close.Width + 10 + bmp_Min.Width * 2),
                    ((Panel_Move_Size + Border_Size) - bmp_Min.Height) / 2, bmp_Min.Width, bmp_Min.Height);
                iconRec = new Rectangle(Panel_move.X + 2, (Panel_Move_Size - ico.Height + 4) / 2,
                    ico.Width, ico.Height);
                TitRec = new Rectangle(Panel_move.X + (iconRec.Width + 5 + (int)m_size.Width),
                    Panel_move.Y, Panel_move.Size.Width - (rectMin.Width*14), Panel_move.Height);
                //e.Graphics.FillRectangle(Brushes.Bisque, TitRec);
                TextRenderer.DrawText(e.Graphics, this.Text, m_Font, 
                    new Rectangle(Panel_move.X + ico.Width ,Panel_move.Y,
                    (int)m_size.Width,(int)m_size.Height), m_TextColor,TextFormatFlags.VerticalCenter);
                TextRenderer.DrawText(e.Graphics, text, mm_font,TitRec, Color.White, Color.Transparent, textFlags);
                e.Graphics.DrawIconUnstretched(ico, iconRec);
               
                
                



            }

        }
开发者ID:sadig41,项目名称:Media_Player,代码行数:90,代码来源:Class1.cs

示例11: OnPaint

        /// <summary>
        /// Draws the list of wizard steps, with the current step highlighted and any disabled steps grayed out.
        /// </summary>

        protected override void OnPaint(PaintEventArgs e)
        {
            Bitmap bg = Properties.Resources.wizard_background;
            int bg_h = (int)(bg.Height * (Width / (float)bg.Width)); //The assumption made is that Width/bg.Width ratio always matches the system's dpi setting. Normally (at 100% dpi setting) this equals to 1.
            int bg_top = Height - bg_h;
            if (bg_top > 0)
            {
                using (SolidBrush bgBrush = new SolidBrush(bgBrushColor))
                    e.Graphics.FillRectangle(bgBrush, new Rectangle(0, 0, Width, bg_top));
            }

            int bg_w = Width;

            //This makes sure we compensate for rounding if it happened while bg_h was calculated. (to avoid gap on the right) 
            //Switch to 125% dpi to see why this is needed...
            if (Width / (float)bg.Width != 1f)
                bg_w++;

            e.Graphics.DrawImage(bg, new Rectangle(0, bg_top, bg_w, bg_h ));

            using (LinearGradientBrush highlight = new LinearGradientBrush(Point.Empty, new Point(Width, 0), HighlightColorEdge, HighlightColorMiddle))
            {
                highlight.SetBlendTriangularShape(0.5f);
                float y = 15F;
                for (int step = 0; step < Steps.Count; step++)
                {
                    if (step == _currentStep)
                    {
                        e.Graphics.FillRectangle(highlight, 0, y, Width, 20F);
                        TextRenderer.DrawText(e.Graphics, Steps[step].Text, Program.DefaultFontBold, new Rectangle(10, (int)y, Width, 20), SystemColors.HighlightText,
                                              TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix);
                    }
                    else
                    {
                        TextRenderer.DrawText(e.Graphics, Steps[step].Text, Program.DefaultFont, new Rectangle(10, (int)y, Width, 20), Steps[step].DisableStep ? SystemColors.GrayText : Color.Black, TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix);
                    }
                    y += 24F;
                }
            }
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:44,代码来源:WizardProgress.cs

示例12: createBufferImage

        private void createBufferImage()
        {
            ProgressBar pb = (ProgressBar)Control.FromHandle(_hProgressBarWnd);
            Rectangle bounds = pb.ClientRectangle;
            Rectangle bdcopy = bounds;
            _cBufferDc.Height = pb.Height;
            _cBufferDc.Width = pb.Width;
            Graphics g = Graphics.FromHdc(_cBufferDc.Hdc);

            using (GraphicsMode mode = new GraphicsMode(g, SmoothingMode.AntiAlias))
            {
                using (GraphicsPath barPath = createRoundRectanglePath(
                    g,
                    bounds.X, bounds.Y,
                    bounds.Width, bounds.Height,
                    1f))
                {
                    using (SolidBrush backBrush = new SolidBrush(pb.BackColor))
                        g.FillRectangle(backBrush, bounds);
                    // draw the frame
                    using (LinearGradientBrush borderBrush = new LinearGradientBrush(
                        bounds,
                        Color.DarkGray,
                        Color.Silver,
                        90f))
                    {
                        borderBrush.SetSigmaBellShape(0.5f);
                        using (Pen borderPen = new Pen(borderBrush, .5f))
                            g.DrawPath(borderPen, barPath);
                    }
                    bounds.Width--;
                    bounds.Height--;
                    // create a clipping region
                    RectangleF clipBounds = bounds;
                    clipBounds.Inflate(-1, -1);
                    using (GraphicsPath clipPath = createRoundRectanglePath(
                        g,
                        clipBounds.X, clipBounds.Y,
                        clipBounds.Width + 1, clipBounds.Height + 1,
                        1f))
                    {
                        using (Region region = new Region(clipPath))
                            g.SetClip(region, CombineMode.Exclude);
                    }
                    // fill in the edge accent
                    using (LinearGradientBrush edgeBrush = new LinearGradientBrush(
                        bounds,
                        Color.DarkGray,
                        Color.Black,
                        90f))
                    {
                        edgeBrush.SetBlendTriangularShape(0.5f);
                        g.FillPath(edgeBrush, barPath);
                        g.ResetClip();
                        bounds.Inflate(-1, -1);
                    }
                    // fill with a subtle glow
                    using (LinearGradientBrush fillBrush = new LinearGradientBrush(
                        bounds,
                        Color.FromArgb(100, Color.White),
                        Color.FromArgb(100, Color.Silver),
                        LinearGradientMode.Vertical))
                    {
                        fillBrush.SetBlendTriangularShape(0.4f);
                        g.FillPath(fillBrush, barPath);
                        g.ResetClip();
                    }
                }
            }
            g.Dispose();
        }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:71,代码来源:cProgressBar.cs

示例13: drawCombo

            private void drawCombo(ToolStripComboBox combo, bool focused)
            {
                Rectangle bounds;
                Rectangle clientBounds = combo.ComboBox.ClientRectangle;
                clientBounds.Height--;

                if (combo.DroppedDown)
                    focused = true;
                if (combo.IsOnOverflow)
                {
                    //bounds.X = 2;
                }
                if (combo.RightToLeft == RightToLeft.Yes)
                    bounds = new Rectangle(new Point(0, 0), new Size(14, combo.Height));
                else
                    bounds = new Rectangle(new Point(combo.Width - 14, 0), new Size(14, combo.Height));

                using (Graphics g = Graphics.FromHwnd(combo.ComboBox.Handle))
                {
                    // prepaint entire background
                    Rectangle flatRect = clientBounds;
                    if (combo.RightToLeft == RightToLeft.Yes)
                        flatRect.X += 14;
                    else
                        flatRect.Width -= 14;
                    flatRect.Inflate(-1, -1);
                    flatRect.Height++;
                    using (Brush flatBrush = new SolidBrush(Color.White))
                        g.FillRectangle(flatBrush, flatRect);

                    if (Parent.ToolStripStyle == ToolStripType.FlatColor)
                    {
                        // fill the background
                        using (Brush flatBrush = new SolidBrush(Parent.ButtonGradientBegin))
                            g.FillRectangle(flatBrush, bounds);
                        // draw a focused mask
                        if (focused)
                        {
                            bounds.Inflate(0, -1);
                            using (Brush flatBrush = new SolidBrush(Color.FromArgb(100, Color.White)))
                                g.FillRectangle(flatBrush, bounds);
                            bounds.Inflate(0, 1);
                        }
                        // frame the button
                        using (Pen framePen = new Pen(Color.FromArgb(100, Parent.SeperatorOuterColor), 0.5f))
                            g.DrawRectangle(framePen, clientBounds);
                        bounds.Width--;
                        // draw a border
                        using (Pen borderPen = new Pen(Color.FromArgb(200, Parent.SeperatorOuterColor), 0.5f))
                            g.DrawRectangle(borderPen, bounds);
                    }
                    else if (Parent.ToolStripStyle == ToolStripType.Image)
                    {
                        // blit the image in
                        if (ToolStrip.BackgroundImage != null)
                        {
                            g.DrawImage(ToolStrip.BackgroundImage, bounds, bounds, GraphicsUnit.Pixel);
                        }
                        if (focused)
                        {
                            // fill in the edge accent
                            using (LinearGradientBrush fillBrush = new LinearGradientBrush(bounds, Color.FromArgb(50, Parent.SeperatorInnerColor), Color.FromArgb(50, Parent.SeperatorOuterColor), 90f))
                            {
                                fillBrush.SetBlendTriangularShape(0.2f);
                                g.FillRectangle(fillBrush, bounds);
                            }
                        }
                        // draw the frame
                        using (Pen framePen = new Pen(Color.FromArgb(150, Color.Black), 0.5f))
                            g.DrawRectangle(framePen, clientBounds);
                        bounds.Width--;
                        using (Pen borderPen = new Pen(Color.FromArgb(200, Color.Black), 0.5f))
                            g.DrawRectangle(borderPen, bounds);
                    }
                    else
                    {
                        // fill in the edge accent
                        using (LinearGradientBrush fillBrush = new LinearGradientBrush(bounds, Parent.ToolStripGradientBegin, Parent.ToolStripGradientEnd, Parent.gradientDirection(_toolStrip, Parent.ToolStripGradientDirection)))
                        {
                            fillBrush.Blend = Parent.ToolStripGradientBlend;
                            g.FillRectangle(fillBrush, bounds);
                        }
                        // draw a focused mask
                        if (focused)
                        {
                            // fill in the mask
                            using (LinearGradientBrush fillBrush = new LinearGradientBrush(bounds, Color.FromArgb(50, Color.LightGray), Color.FromArgb(50, Color.White), 90f))
                            {
                                fillBrush.SetBlendTriangularShape(0.2f);
                                g.FillRectangle(fillBrush, bounds);
                            }
                        }
                        using (Pen framePen = new Pen(Color.FromArgb(150, Color.Black), 0.5f))
                            g.DrawRectangle(framePen, clientBounds);
                        bounds.Width--;
                        using (Pen borderPen = new Pen(Color.FromArgb(200, Color.Black), 0.5f))
                            g.DrawRectangle(borderPen, bounds);
                    }
                    drawComboArrow(g, bounds);
                }
//.........这里部分代码省略.........
开发者ID:Egoily,项目名称:CSharp-EAlbum,代码行数:101,代码来源:FaceRender.cs

示例14: OnPaint

        /// <summary>
        /// Draws the list of wizard steps, with the current step highlighted and any disabled steps grayed out.
        /// </summary>
        protected override void OnPaint(PaintEventArgs e)
        {
            Bitmap bg = Properties.Resources.wizard_background;
            int bg_h = bg.Height;
            int bg_top = Height - bg_h;
            if (bg_top > 0)
                e.Graphics.FillRectangle(bgBrush, new Rectangle(0, 0, Width, bg_top));
            e.Graphics.DrawImage(bg, new Rectangle(0, bg_top, bg.Width, bg_h));

            using (LinearGradientBrush highlight = new LinearGradientBrush(Point.Empty, new Point(Width, 0), HighlightColorEdge, HighlightColorMiddle))
            {
                highlight.SetBlendTriangularShape(0.5f);
                float y = 15F;
                for (int step = 0; step < Steps.Count; step++)
                {
                    if (step == _currentStep)
                    {
                        e.Graphics.FillRectangle(highlight, 0, y, Width, 20F);
                        TextRenderer.DrawText(e.Graphics, Steps[step].Text, Program.DefaultFontBold, new Rectangle(10, (int)y, Width, 20), SystemColors.HighlightText,
                                              TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix);
                    }
                    else
                    {
                        TextRenderer.DrawText(e.Graphics, Steps[step].Text, Program.DefaultFont, new Rectangle(10, (int)y, Width, 20), Steps[step].DisableStep ? SystemColors.GrayText : Color.Black, TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix);
                    }
                    y += 24F;
                }
            }
        }
开发者ID:ChrisH4rding,项目名称:xenadmin,代码行数:32,代码来源:WizardProgress.cs

示例15: PaintView8

        void PaintView8(Graphics g)
        {
            // Create a LinearGradientBrush.
            Rectangle myRect = new Rectangle(20, 20, 200, 100);
            LinearGradientBrush myLGBrush = new LinearGradientBrush(
                myRect, Color.Blue, Color.Red, 0.0f, true);

            // Draw an ellipse to the screen using the LinearGradientBrush.
            g.FillEllipse(myLGBrush, myRect);

            // Create a triangular shaped brush with the peak at the center
            // of the drawing area.
            myLGBrush.SetBlendTriangularShape(.50f, 1.0f);

            // Use the triangular brush to draw a second ellipse.
            myRect.Y = 150;
            g.FillEllipse(myLGBrush, myRect);
        }
开发者ID:asfungithub,项目名称:sysdrawing-coregraphics,代码行数:18,代码来源:DrawingView.cs


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