public VS2005MultithreadingDockPaneCaption(DockPane pane)
            : base(pane)
        {
            SuspendLayout();

            m_components = new Container();
            m_toolTip = new ToolTip(Components);

            // clone shared resources
            lock (typeof(Resources))
            {
                _imageButtonAutoHide = (Bitmap)Resources.DockPane_AutoHide.Clone();
                _imageButtonClose = (Bitmap)Resources.DockPane_Close.Clone();
                _imageButtonDock = (Bitmap)Resources.DockPane_Dock.Clone();
                _imageButtonOptions = (Bitmap)Resources.DockPane_Option.Clone();
            }

            // create background blend
            _activeBackColorGradientBlend = new Blend(2)
            {
                Factors = new float[] { 0.5F, 1.0F },
                Positions = new float[] { 0.0F, 1.0F },
            };

            ResumeLayout();
        }
Пример #2
0
        public static void PaintVignette(Graphics g, Rectangle bounds)
        {
            Rectangle ellipsebounds = bounds;
            ellipsebounds.Offset(-ellipsebounds.X, -ellipsebounds.Y);
            int x = ellipsebounds.Width - (int)Math.Round(.70712 * ellipsebounds.Width);
            int y = ellipsebounds.Height - (int)Math.Round(.70712 * ellipsebounds.Height);
            ellipsebounds.Inflate(x, y);

            using (GraphicsPath path = new GraphicsPath())
            {
                path.AddEllipse(ellipsebounds);
                using (PathGradientBrush brush = new PathGradientBrush(path))
                {
                    brush.WrapMode = WrapMode.Tile;
                    brush.CenterColor = Color.FromArgb(0, 0, 0, 0);
                    brush.SurroundColors = new Color[] { Color.FromArgb(255, 0, 0, 0) };
                    Blend blend = new Blend();
                    blend.Positions = new float[] { 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0F };
                    blend.Factors = new float[] { 0.0f, 0.5f, 1f, 1f, 1.0f, 1.0f };
                    brush.Blend = blend;
                    Region oldClip = g.Clip;
                    g.Clip = new Region(bounds);
                    g.FillRectangle(brush, ellipsebounds);
                    g.Clip = oldClip;
                }
            }
        }
Пример #3
0
 static KryptonSparkleRenderer()
 {
     // One time creation of the blend for the status strip gradient brush
     _statusStripBlend = new Blend();
     _statusStripBlend.Factors = new float[] { 0.0f, 0.0f, 0.0f, 1.0f };
     _statusStripBlend.Positions = new float[] { 0.0f, 0.33f, 0.33f, 1.0f };
 }
Пример #4
0
 static Office2007Renderer()
 {
     // One time creation of the blend for the status strip gradient brush
     m_statusStripBlend = new Blend();
     m_statusStripBlend.Positions = new float[] { 0.0F, 0.2F, 0.3F, 0.4F, 0.8F, 1.0F };
     m_statusStripBlend.Factors = new float[] { 0.3F, 0.4F, 0.5F, 1.0F, 0.8F, 0.7F };
 }
Пример #5
0
 /// <summary>  
 /// 渲染菜单项的背景  
 /// </summary>  
 /// <param name="e"></param>  
 protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
 {
     if (e.ToolStrip is MenuStrip)
     {
         //如果被选中或被按下
         if (e.Item.Selected || e.Item.Pressed)
         {
             Blend blend = new Blend();
             float[] fs = new float[5] { 0f, 0.3f, 0.5f, 0.8f, 1f };
             float[] f = new float[5] { 0f, 0.5f, 1f, 0.5f, 0f };
             blend.Positions = fs;
             blend.Factors = f;
             FillLineGradient(e.Graphics, new Rectangle(0, 0, e.Item.Size.Width, e.Item.Size.Height),
                 e.Item.Pressed ? colorconfig.DropDownItemBackColor : colorconfig.MenuItemStartColor,
                 e.Item.Pressed ? colorconfig.DropDownItemBackColor : colorconfig.MenuItemEndColor,
                 90f, blend);
         }
         else
             base.OnRenderMenuItemBackground(e);
     }
     else if (e.ToolStrip is ToolStripDropDown)
     {
         if (e.Item.Selected)
         {
             FillLineGradient(e.Graphics, new Rectangle(2, 2, e.Item.Size.Width-4, e.Item.Size.Height-4), colorconfig.DropDownItemStartColor, colorconfig.DropDownItemEndColor, 90f, null);
         }
     }
     else
     {
         base.OnRenderMenuItemBackground(e);
     }
 }
        public override void PaintValue(PaintValueEventArgs e)
        {
            if (!(e.Context.Instance is KrbTabControl)) return;
            var parent = (KrbTabControl)e.Context.Instance;
            var caption = (ButtonsCaption)e.Value;

            using (var brush = new LinearGradientBrush(e.Bounds, parent.GradientCaption.InactiveCaptionColorStart, parent.GradientCaption.InactiveCaptionColorEnd, parent.GradientCaption.CaptionGradientStyle))
            {
                var bl = new Blend(2) { Factors = new[] { 0.1F, 1.0F }, Positions = new[] { 0.0F, 1.0F } };
                brush.Blend = bl;
                e.Graphics.FillRectangle(brush, e.Bounds);

                Image captionDropDown = Resources.DropDown;
                using (var attributes = new ImageAttributes())
                {
                    var map = new[]
                    {
                        new ColorMap {OldColor = Color.White, NewColor = Color.Transparent},
                        new ColorMap {OldColor = Color.Black, NewColor = caption.InactiveCaptionButtonsColor}
                    };

                    attributes.SetRemapTable(map);

                    var rect = e.Bounds;
                    rect.Inflate(-3, 0);
                    e.Graphics.DrawImage(captionDropDown, rect, 0, 0, captionDropDown.Width, captionDropDown.Height, GraphicsUnit.Pixel, attributes);
                }
            }
        }
 static KryptonOffice2007Renderer()
 {
     // One time creation of the blend for the status strip gradient brush
     _statusStripBlend = new Blend();
     _statusStripBlend.Positions = new float[] { 0.0f, 0.25f, 0.25f, 0.57f, 0.86f, 1.0f };
     _statusStripBlend.Factors = new float[] { 0.1f, 0.6f, 1.0f, 0.4f, 0.0f, 0.95f };
 }
Пример #8
0
        public static System.Drawing.Drawing2D.Blend Convert(this AGS.API.IBlend blend)
        {
            var result = new System.Drawing.Drawing2D.Blend(blend.Positions.Length);

            result.Positions = blend.Positions;
            result.Factors   = blend.Factors;
            return(result);
        }
Пример #9
0
        private void ArcGauge_Paint(object sender, PaintEventArgs e)
        {
            using (System.Drawing.Drawing2D.GraphicsPath gPath = new System.Drawing.Drawing2D.GraphicsPath())
            {
                e.Graphics.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                e.Graphics.InterpolationMode = InterpolationMode.High;

                //antialias the outer edge
                using (Pen pen = new Pen(_color1, 2))
                    e.Graphics.DrawArc(pen, _r, _sAngle, _swAngle);

                gPath.AddArc(_r, _sAngle, _swAngle);
                using (System.Drawing.Drawing2D.PathGradientBrush p = new System.Drawing.Drawing2D.PathGradientBrush(gPath))
                {
                    p.WrapMode = System.Drawing.Drawing2D.WrapMode.Clamp;

                    System.Drawing.Drawing2D.Blend b = new System.Drawing.Drawing2D.Blend();
                    b.Factors   = new float[] { 1, 1, 0, 0, 0 };
                    b.Positions = CalcPositions(_r, _outerWidth);
                    p.Blend     = b;

                    p.CenterColor = _color1;
                    p.CenterPoint = new PointF(_r.Width / 2f + _r.X, _r.Height / 2f + _r.Y);
                    //p.SurroundColors = new Color[] { _color2 };

                    using (Pen pen = new Pen(p, _w))
                        e.Graphics.DrawArc(pen, _r, _sAngle, _swAngle);
                }



                // e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                // e.Graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
                // e.Graphics.InterpolationMode = InterpolationMode.High;

                // Pen redPen = new Pen(Color.Red, _arcBrushSize);
                // redPen.SetLineCap(LineCap.Flat, LineCap.Flat, DashCap.Flat);

                // Rectangle rect = new Rectangle(_arcBrushSize/2, _arcBrushSize/2, _width - _arcBrushSize, _height);
                // e.Graphics.DrawArc(redPen, rect, 180, 180);

                //// Pen bluePen = new Pen(Color.Blue, _arcBrushSize);
                //// e.Graphics.DrawArc(bluePen, rect, 180, 50);


                // int textx = _width / 2;
                // int texty = _height / 2;

                // String text = "5.7";
                // SizeF s = e.Graphics.MeasureString(text, new Font("Arial", 25, FontStyle.Bold));
                // e.Graphics.DrawString("5.7", new Font("Arial", 25, FontStyle.Bold), Brushes.Black, textx- s.Width/2, texty - s.Height/2);

                // bluePen.Dispose();
                // redPen.Dispose();
            }
        }
        static RenderExpertHelpers()
        {
            _rounded1Blend = new Blend();
            _rounded1Blend.Positions = new float[] { 0.0f, 0.1f, 1.0f };
            _rounded1Blend.Factors = new float[] { 0.0f, 1.0f, 1.0f };

            _rounded2Blend = new Blend();
            _rounded2Blend.Positions = new float[] { 0.0f, 0.50f, 0.75f, 1.0f };
            _rounded2Blend.Factors = new float[] { 0.0f, 1.0f, 1.0f, 1.0f };
        }
Пример #11
0
        static ViewDrawRibbonTab()
        {
            _contextBlend2007 = new Blend();
            _contextBlend2007.Factors = new float[] { 0.0f, 0.0f, 1.0f, 1.0f };
            _contextBlend2007.Positions = new float[] { 0.0f, 0.41f, 0.7f, 1.0f };

            _contextBlend2010 = new Blend();
            _contextBlend2010.Factors = new float[] { 0.0f, 1.0f, 1.0f };
            _contextBlend2010.Positions = new float[] { 0.0f, 0.6f, 1.0f };
        }
Пример #12
0
		private static Blend GetBackgroundBlend(){
			float[] relativeIntensities = new float[]{0f, 0.5f, 1f, 1f};
			float[] relativePositions = new float[]{0f, 0.5f, 0.51f, 1f};


			Blend blend = new Blend();
			blend.Factors = relativeIntensities;
			blend.Positions = relativePositions;
			
			return blend;
		}
Пример #13
0
 public static Brush createFluffyBrush(GraphicsPath gp, float[] blendPositions, float[] blendFactors )
 {
     PathGradientBrush pgb = new PathGradientBrush( gp );
     Blend blend = new Blend();
     blend.Positions = blendPositions;
     blend.Factors = blendFactors;
     pgb.Blend = blend;
     pgb.CenterColor = Color.White;
     pgb.SurroundColors = new Color[] { Color.Black };
     return pgb;
 }
Пример #14
0
		protected override LinearGradientBrush CreateTabGradientBrush(Rectangle r,Color color1,Color color2,int gradientAngle)
		{
			LinearGradientBrush brush=base.CreateTabGradientBrush(r,color1,color2,gradientAngle);
			
			Blend blend=new Blend(5);
			blend.Factors=new float[]{0,.6f,1f,.6f,0f};
			blend.Positions=new float[]{0,.3f,.5f,.7f,1f};
			brush.Blend=blend;

			return brush;
		}
Пример #15
0
		public ThemeNice( )
		{
			ColorControl = NiceBackColor;
			
			FlatBlend = new Blend ();
			FlatBlend.Factors = new float []{0.0f, 0.992f, 1.0f};
			FlatBlend.Positions = new float []{0.0f, 0.68f, 1.0f};
			
			NormalBlend = new Blend ();
			NormalBlend.Factors = new float []{0.0f, 0.008f, 1.0f};
			NormalBlend.Positions = new float []{0.0f, 0.32f, 1.0f};
		}
Пример #16
0
		public void TestConstructors ()
		{
			Blend blend0 = new Blend ();

			Assert.AreEqual (1, blend0.Factors.Length, "C#1");
			Assert.AreEqual (1, blend0.Positions.Length, "C#2");

			Blend blend1 = new Blend (1);

			Assert.AreEqual (1, blend1.Factors.Length, "C#3");
			Assert.AreEqual (1, blend1.Positions.Length, "C#4");
		}
        /// <summary>
        /// Processes the image.
        /// </summary>
        /// <param name="factory">
        /// The the current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class containing
        /// the image to process.
        /// </param>
        /// <param name="image">The current image to process</param>
        /// <param name="newImage">The new Image to return</param>
        /// <returns>
        /// The processed image from the current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
        /// </returns>
        public Image TransformImage(ImageFactory factory, Image image, Image newImage)
        {
            using (Graphics graphics = Graphics.FromImage(newImage))
            {
                using (ImageAttributes attributes = new ImageAttributes())
                {
                    attributes.SetColorMatrix(this.Matrix);

                    Rectangle rectangle = new Rectangle(0, 0, image.Width, image.Height);

                    graphics.DrawImage(image, rectangle, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, attributes);

                    // Add a glow to the image.
                    using (GraphicsPath path = new GraphicsPath())
                    {
                        path.AddEllipse(rectangle);
                        using (PathGradientBrush brush = new PathGradientBrush(path))
                        {
                            // Fill a rectangle with an elliptical gradient brush that goes from orange to transparent.
                            // This has the effect of painting the far corners transparent and fading in to orange on the
                            // way in to the centre.
                            brush.WrapMode = WrapMode.Tile;
                            brush.CenterColor = Color.FromArgb(70, 255, 153, 102);
                            brush.SurroundColors = new Color[] { Color.FromArgb(0, 0, 0, 0) };

                            Blend blend = new Blend
                            {
                                Positions = new float[] { 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0F },
                                Factors = new float[] { 0.0f, 0.5f, 1f, 1f, 1.0f, 1.0f }
                            };

                            brush.Blend = blend;

                            Region oldClip = graphics.Clip;
                            graphics.Clip = new Region(rectangle);
                            graphics.FillRectangle(brush, rectangle);
                            graphics.Clip = oldClip;
                        }
                    }
                }
            }

            // Add a vignette to finish the effect.
            factory.Update(newImage);
            Vignette vignette = new Vignette();
            newImage = (Bitmap)vignette.ProcessImage(factory);

            // Reassign the image.
            image.Dispose();
            image = newImage;

            return image;
        }
 private void InitializeBlends()
 {
     this.ActiveTabBlend = new Blend();
     this.ActiveTabBlend.Factors = new float[] { 0.3f, 0.4f, 0.5f, 1f, 1f };
     this.ActiveTabBlend.Positions = new float[] { 0f, 0.2f, 0.35f, 0.35f, 1f };
     this.InactiveTabBlend = new Blend();
     this.InactiveTabBlend.Factors = new float[] { 0.3f, 0.4f, 0.5f, 1f, 0.8f, 0.7f };
     this.InactiveTabBlend.Positions = new float[] { 0f, 0.2f, 0.4f, 0.4f, 0.8f, 1f };
     this.ShadowBlend = new Blend();
     this.ShadowBlend.Factors = new float[] { 0f, 0.1f, 0.3f, 0.4f };
     this.ShadowBlend.Positions = new float[] { 0f, 0.5f, 0.8f, 1f };
 }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonPanel class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon instance.</param>
        /// <param name="paletteBack">Reference to palette for obtaining background colors.</param>
        /// <param name="paintDelegate">Delegate for generating repaints.</param>
        public ViewDrawRibbonPanel(KryptonRibbon ribbon,
                                   IPaletteBack paletteBack,
                                   NeedPaintHandler paintDelegate)
            : base(paletteBack)
        {
            _ribbon = ribbon;
            _paintDelegate = paintDelegate;

            _compBlend = new Blend();
            _compBlend.Positions = new float[] { 0.0f, 0.4f, 1.0f };
            _compBlend.Factors = new float[] { 0.0f, 0.87f, 1.0f };
        }
 public override void PaintValue(PaintValueEventArgs e)
 {
     CaptionGradient gradient = e.Value as CaptionGradient;
     using (LinearGradientBrush brush = new LinearGradientBrush(e.Bounds, gradient.InactiveCaptionColorStart, gradient.InactiveCaptionColorEnd, gradient.CaptionGradientStyle))
     {
         Blend bl = new Blend(2);
         bl.Factors = new float[] { 0.1F, 1.0F };
         bl.Positions = new float[] { 0.0F, 1.0F };
         brush.Blend = bl;
         e.Graphics.FillRectangle(brush, e.Bounds);
     }
 }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonComposition class.
        /// </summary>
        /// <param name="ribbon">Owning control instance.</param>
        /// <param name="needPaint">Delegate for requested a paint.</param>
        public ViewDrawRibbonComposition(KryptonRibbon ribbon,
                                         NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(needPaint != null);

            _ribbon = ribbon;
            _needPaint = needPaint;

            _compBlend = new Blend();
            _compBlend.Positions = new float[] { 0.0f, 0.25f, 1.0f };
            _compBlend.Factors = new float[] { 0.0f, 0.0f, 0.40f };
        }
 public XPProgressBarRenderer(Color barColor, int chunkWidth)
 {
     this.BarBackgroundColor = Color.White;
     this.MarqueeChunks = 4;
     this.MarqueeStyle = Nomad.Controls.MarqueeStyle.LeftRight;
     this.BarColor = barColor;
     this.ChunkWidth = chunkWidth;
     float[] numArray = new float[] { 0.1f, 1f, 1f, 1f, 1f, 0.85f, 0.1f };
     float[] numArray2 = new float[] { 0f, 0.2f, 0.5f, 0.5f, 0.5f, 0.8f, 1f };
     this.BarBlend = new Blend();
     this.BarBlend.Factors = numArray;
     this.BarBlend.Positions = numArray2;
 }
Пример #23
0
        static RenderOffice2007()
        {
            _ribbonGroup5Blend = new Blend();
            _ribbonGroup5Blend.Factors = new float[] { 0.0f, 0.0f, 1.0f };
            _ribbonGroup5Blend.Positions = new float[] { 0.0f, 0.5f, 1.0f };

            _ribbonGroup6Blend = new Blend();
            _ribbonGroup6Blend.Factors = new float[] { 0.0f, 0.0f, 0.75f, 1.0f };
            _ribbonGroup6Blend.Positions = new float[] { 0.0f, 0.1f, 0.45f, 1.0f };

            _ribbonGroup7Blend = new Blend();
            _ribbonGroup7Blend.Factors = new float[] { 0.0f, 1.0f, 1.0f, 0.0f };
            _ribbonGroup7Blend.Positions = new float[] { 0.0f, 0.15f, 0.85f, 1.0f };
        }
Пример #24
0
		private void SetBrushes(){
			pen=new Pen(Color.Black,1.6f);
			hoverBrush=new PathGradientBrush(
				new Point[] {new Point(0,0),new Point(Width-1,0),new Point(Width-1,Height-1),new Point(0,Height-1)});
			hoverBrush.CenterColor=Color.White;
			surroundColor=Color.FromArgb(249,187,67);
			hoverBrush.SurroundColors=new Color[] {surroundColor,surroundColor,surroundColor,surroundColor};
			Blend blend=new Blend();
			float[] myFactors = {0f,.5f,1f,1f,1f,1f};
			float[] myPositions = {0f,.2f,.4f,.6f,.8f,1f};
			blend.Factors=myFactors;
			blend.Positions=myPositions;
			hoverBrush.Blend=blend;
		}
        static KryptonOffice2013Renderer()
        {
            _stripBlend = new Blend();
            _stripBlend.Positions = new float[] { 0.0f, 0.33f, 0.66f, 1.0f };
            _stripBlend.Factors = new float[] { 0.0f, 0.5f, 0.8f, 1.0f };

            _separatorDarkBlend = new Blend();
            _separatorDarkBlend.Positions = new float[] { 0.0f, 0.5f, 1.0f };
            _separatorDarkBlend.Factors = new float[] { 0.2f, 1f, 0.2f };

            _separatorLightBlend = new Blend();
            _separatorLightBlend.Positions = new float[] { 0.0f, 0.5f, 1.0f };
            _separatorLightBlend.Factors = new float[] { 0.1f, 0.6f, 0.1f };
        }
Пример #26
0
		static BseRenderer()
        {
            MarginInset = 2;
            
            // One time creation of the blend for the button gradient brush
            ButtonBlend = new Blend();
            ButtonBlend.Positions = new float[] { 0.0F, 0.1F, 0.2F, 0.5F, 1.0F };
            ButtonBlend.Factors = new float[] { 0.6F, 0.7F, 0.8F, 1.0F, 1.0F };
            // One time creation of the blend for the menuitem gradient brush
            MenuItemBlend = new Blend();
            MenuItemBlend.Positions = new float[] { 0.0F, 0.1F, 0.2F, 0.5F, 1.0F };
            MenuItemBlend.Factors = new float[] { 0.7F, 0.8F, 0.9F, 1.0F, 1.0F };

            baseSizeGripRectangles = new Rectangle[] { new Rectangle(8, 0, 2, 2), new Rectangle(8, 4, 2, 2), new Rectangle(8, 8, 2, 2), new Rectangle(4, 4, 2, 2), new Rectangle(4, 8, 2, 2), new Rectangle(0, 8, 2, 2) };
        }
Пример #27
0
 private void DrawBackground(Graphics gr)
 {
     Rectangle backgroundRectangle = BarRectangle;
     backgroundRectangle.Inflate(-1, -1);
     if (backgroundRectangle.Width < 2)
         return;
     using (LinearGradientBrush brush = new LinearGradientBrush(Point.Empty, new Point(0, backgroundRectangle.Height),
         COLORS[1], COLORS[2]))
     {
         Blend bl = new Blend(2);
         bl.Factors = new float[] { 0.3F, 1.0F };
         bl.Positions = new float[] { 0.0F, 1.0F };
         brush.Blend = bl;
         gr.FillRectangle(brush, backgroundRectangle);
     }
 }
Пример #28
0
 static DrawingHelpers()
 {
     shadowBlendScaleLinear = new Blend(3);
     shadowBlendScaleLinear.Positions[0]=0.0f;
     shadowBlendScaleLinear.Factors[0]=0.0f;
     shadowBlendScaleLinear.Positions[1]=0.50f;
     shadowBlendScaleLinear.Factors[1]=0.80f;
     shadowBlendScaleLinear.Positions[2]=1f;
     shadowBlendScaleLinear.Factors[2]=1f;
     shadowBlendScaleRadial = new Blend(3);
     shadowBlendScaleRadial.Positions[0]=0.0f;
     shadowBlendScaleRadial.Factors[0]=0.0f;
     shadowBlendScaleRadial.Positions[1]=0.50f;
     shadowBlendScaleRadial.Factors[1]=0.20f;
     shadowBlendScaleRadial.Positions[2]=1f;
     shadowBlendScaleRadial.Factors[2]=1f;
 }
Пример #29
0
 protected override void OnPaint(PaintEventArgs e)
 {
     if (this.Paint != null)
     {
         this.Paint(this, e);
     }
     else
     {
         base.OnPaint(e);
         float num = 1f - (((float) base.Width) / ((float) base.Height));
         float angle = 50f - (15f * num);
         Rectangle rect = new Rectangle(this.PosFromAlignment.X, this.PosFromAlignment.Y, this.itemSize.Width, this.itemSize.Height);
         LinearGradientBrush brush = new LinearGradientBrush(rect, ControlPaint.Dark(base.Parent.BackColor), ControlPaint.LightLight(base.Parent.BackColor), angle);
         Blend blend = new Blend();
         blend.Positions = new float[] { 0f, 0.2f, 0.4f, 0.6f, 0.8f, 1f };
         blend.Factors = new float[] { 0.2f, 0.2f, 0.4f, 0.4f, 1f, 1f };
         brush.Blend = blend;
         Rectangle rectangle2 = rect;
         rectangle2.Inflate(1, 1);
         e.Graphics.FillEllipse(brush, rectangle2);
         if (base.Enabled)
         {
             if (this.Checked)
             {
                 e.Graphics.FillEllipse(new SolidBrush(ControlPaint.Light(this.ledColor)), this.PosFromAlignment.X, this.PosFromAlignment.Y, this.itemSize.Width, this.itemSize.Height);
             }
             else
             {
                 e.Graphics.FillEllipse(new SolidBrush(ControlPaint.Dark(this.ledColor)), this.PosFromAlignment.X, this.PosFromAlignment.Y, this.itemSize.Width, this.itemSize.Height);
             }
         }
         LinearGradientBrush brush2 = new LinearGradientBrush(rect, Color.FromArgb(150, 0xff, 0xff, 0xff), Color.Transparent, angle);
         LinearGradientBrush brush3 = new LinearGradientBrush(rect, Color.FromArgb(100, 0xff, 0xff, 0xff), Color.FromArgb(100, 0xff, 0xff, 0xff), angle);
         Blend blend2 = new Blend();
         blend2.Positions = new float[] { 0f, 0.2f, 0.4f, 0.6f, 0.8f, 1f };
         blend2.Factors = new float[] { 0.2f, 0.2f, 0.4f, 0.4f, 1f, 1f };
         brush2.Blend = blend2;
         brush3.Blend = blend2;
         e.Graphics.FillEllipse(brush3, (int) (this.PosFromAlignment.X + ((this.itemSize.Width * 13) / 100)), (int) (this.PosFromAlignment.Y + ((this.itemSize.Height * 13) / 100)), (int) ((this.itemSize.Width * 40) / 100), (int) ((this.itemSize.Height * 40) / 100));
         e.Graphics.FillEllipse(brush2, new Rectangle(this.PosFromAlignment, this.itemSize));
     }
 }
Пример #30
0
		public void TestProperties () 
		{
			Blend blend0 = new Blend ();

			Assert.AreEqual (0, blend0.Factors[0], "P#1");
			Assert.AreEqual (0, blend0.Positions[0], "P#2");

			Blend blend1 = new Blend (1);
			float[] positions = {0.0F, 0.5F, 1.0F};
			float[] factors = {0.0F, 0.5F, 1.0F};
			blend1.Factors = factors;
			blend1.Positions = positions;

			Assert.AreEqual (factors[0], blend1.Factors[0], "P#3");
			Assert.AreEqual (factors[1], blend1.Factors[1], "P#4");
			Assert.AreEqual (factors[2], blend1.Factors[2], "P#5");
			Assert.AreEqual (positions[0], blend1.Positions[0], "P#6");
			Assert.AreEqual (positions[1], blend1.Positions[1], "P#7");
			Assert.AreEqual (positions[2], blend1.Positions[2], "P#8");
		}
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            Brush borderBrush = Brushes.Black;
            e.Graphics.FillRegion(borderBrush, this.Region);

            Region gradientRegion = Growl.DisplayStyle.Utility.CreateRoundedRegion(borderWidth, borderWidth, this.Width - (1 * borderWidth), this.Height - (1 * borderWidth), radius - borderWidth, radius - borderWidth);
            using (gradientRegion)
            {
                RectangleF rect = gradientRegion.GetBounds(e.Graphics);
                LinearGradientBrush brush = new LinearGradientBrush(rect, Color.Gainsboro, Color.White, LinearGradientMode.Vertical);
                using (brush)
                {
                    float f1 = ((float) 25) / ((float)this.Height);
                    float f2 = ((float) 125) / ((float)this.Height);
                    Blend blend = new Blend();
                    blend.Factors = new float[] { 0.0F, 1.0F, 1.0F, 0.0F };
                    blend.Positions = new float[] { 0.0F, f1, f2, 1.0F };
                    brush.Blend = blend;
                    e.Graphics.FillRegion(brush, gradientRegion);
                }
            }
        }
Пример #32
0
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            Brush borderBrush = Brushes.Black;
            e.Graphics.FillRegion(borderBrush, this.Region);

            Region gradientRegion = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(borderWidth, borderWidth, this.Width - (1 * borderWidth), this.Height - (1 * borderWidth), radius - borderWidth, radius - borderWidth));
            using (gradientRegion)
            {
                RectangleF rect = gradientRegion.GetBounds(e.Graphics);
                LinearGradientBrush brush = new LinearGradientBrush(rect, Color.Gainsboro, Color.White, LinearGradientMode.Vertical);
                using (brush)
                {
                    float f1 = ((float)this.listViewFeeds.Top) / ((float)this.Height);
                    float f2 = ((float)this.listViewFeeds.Bottom) / ((float)this.Height);
                    Blend blend = new Blend();
                    blend.Factors = new float[] { 0.0F, 1.0F, 1.0F, 0.0F };
                    blend.Positions = new float[] { 0.0F, f1, f2, 1.0F };
                    brush.Blend = blend;
                    e.Graphics.FillRegion(brush, gradientRegion);
                }
            }
        }
Пример #33
0
        /**
         * Get/set blend factors
         *
         * @notes If the blendFactors.Length = 1, then it's treated
         *  as the falloff parameter. Otherwise, it's the array
         *  of blend factors.
         */

        private Blend _GetBlend()
        {
            // VSWHidbey 518309 - interpolation colors and blends don't get along.  Just getting
            // the Blend when InterpolationColors was set puts the Brush into an unusable state afterwards.
            // so to avoid that (mostly the problem of having Blend pop up in the debugger window and cause this problem)
            // we just bail here.
            //
            if (_interpolationColorsWasSet)
            {
                return(null);
            }

            Blend blend;

            // Figure out the size of blend factor array
            int status = SafeNativeMethods.Gdip.GdipGetLineBlendCount(new HandleRef(this, NativeBrush), out int retval);

            if (status != SafeNativeMethods.Gdip.Ok)
            {
                throw SafeNativeMethods.Gdip.StatusException(status);
            }
            if (retval <= 0)
            {
                return(null);
            }

            // Allocate temporary native memory buffer
            int count = retval;

            IntPtr factors   = IntPtr.Zero;
            IntPtr positions = IntPtr.Zero;

            try
            {
                int size = checked (4 * count);
                factors   = Marshal.AllocHGlobal(size);
                positions = Marshal.AllocHGlobal(size);

                // Retrieve horizontal blend factors
                status = SafeNativeMethods.Gdip.GdipGetLineBlend(new HandleRef(this, NativeBrush), factors, positions, count);

                if (status != SafeNativeMethods.Gdip.Ok)
                {
                    throw SafeNativeMethods.Gdip.StatusException(status);
                }

                // Return the result in a managed array
                blend = new Blend(count);

                Marshal.Copy(factors, blend.Factors, 0, count);
                Marshal.Copy(positions, blend.Positions, 0, count);
            }
            finally
            {
                if (factors != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(factors);
                }
                if (positions != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(positions);
                }
            }

            return(blend);
        }