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


C# RadialGradientBrush.Freeze方法代码示例

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


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

示例1: ResizeChrome

		static ResizeChrome()
		{
			TransparentBrush = Brushes.Transparent;
			TransparentBrush.Freeze();
			var borderBrush = new LinearGradientBrush()
			{
				Opacity = 0.7,
				StartPoint = new Point(0, 0),
				EndPoint = new Point(1, 0.3),

			};
			borderBrush.GradientStops.Add(new GradientStop(Colors.SlateBlue, 0));
			borderBrush.GradientStops.Add(new GradientStop(Colors.LightBlue, 0.5));
			borderBrush.GradientStops.Add(new GradientStop(Colors.SlateBlue, 1));
			borderBrush.Freeze();
			BorderBrush = borderBrush;
			var thumbBrush = new RadialGradientBrush()
			{
				Center = new Point(0.3, 0.3),
				GradientOrigin = new Point(0.3, 0.3),
				RadiusX = 0.7,
				RadiusY = 0.7,
			};
			thumbBrush.GradientStops.Add(new GradientStop(Colors.White, 0));
			thumbBrush.GradientStops.Add(new GradientStop(Colors.DarkSlateBlue, 0.9));
			thumbBrush.Freeze();
			ThumbBrush = thumbBrush;
			TransparentPen = new Pen(TransparentBrush, 3.5);
			BorderPen = new Pen(BorderBrush, 2);
			BorderPen.DashStyle = DashStyles.Dash;
			ThumbGeometry = new EllipseGeometry();
			UpdateZoom(1);
		}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:33,代码来源:ResizeChrome.cs

示例2: GetForegroundBrush

        private Brush GetForegroundBrush()
        {
            if (!IsMouseOver)
            {
                return new SolidColorBrush(BackgroundColor);
            }
            else
            {
                RadialGradientBrush brush = new RadialGradientBrush(Colors.White, BackgroundColor);
                Point absoluteGradientOrigin = Mouse.GetPosition(this);
                Point relativeGradientOrigin = new Point(
                    absoluteGradientOrigin.X / base.ActualWidth, absoluteGradientOrigin.Y / base.ActualHeight);

                brush.GradientOrigin = relativeGradientOrigin;
                brush.Center = relativeGradientOrigin;
                brush.Freeze();
                return brush;
            }
        }
开发者ID:ittray,项目名称:LocalDemo,代码行数:19,代码来源:CustomDrawnElement.cs

示例3: CreateBrushes

        // *** Private static methods ***
        private static void CreateBrushes()
        {
            // Get the colors for the shadow
            Color shadowColor = Color.FromArgb(128, 0, 0, 0);
            Color transparentColor = Color.FromArgb(16, 0, 0, 0);
            // Create a GradientStopCollection from these
            GradientStopCollection gradient = new GradientStopCollection(2);
            gradient.Add(new GradientStop(shadowColor, 0.5));
            gradient.Add(new GradientStop(transparentColor, 1.0));
            gradient.Freeze();
            // Create the background brush
            backgroundBrush = new SolidColorBrush(shadowColor);
            backgroundBrush.Freeze();
            // Create the LinearGradientBrushes
            rightBrush = new LinearGradientBrush(gradient, new Point(0.0, 0.0), new Point(1.0, 0.0)); rightBrush.Freeze();
            bottomBrush = new LinearGradientBrush(gradient, new Point(0.0, 0.0), new Point(0.0, 1.0)); bottomBrush.Freeze();
            // Create the RadialGradientBrushes
            bottomRightBrush = new RadialGradientBrush(gradient);
            bottomRightBrush.GradientOrigin = new Point(0.0, 0.0);
            bottomRightBrush.Center = new Point(0.0, 0.0);
            bottomRightBrush.RadiusX = 1.0;
            bottomRightBrush.RadiusY = 1.0;
            bottomRightBrush.Freeze();

            topRightBrush = new RadialGradientBrush(gradient);
            topRightBrush.GradientOrigin = new Point(0.0, 1.0);
            topRightBrush.Center = new Point(0.0, 1.0);
            topRightBrush.RadiusX = 1.0;
            topRightBrush.RadiusY = 1.0;
            topRightBrush.Freeze();

            bottomLeftBrush = new RadialGradientBrush(gradient);
            bottomLeftBrush.GradientOrigin = new Point(1.0, 0.0);
            bottomLeftBrush.Center = new Point(1.0, 0.0);
            bottomLeftBrush.RadiusX = 1.0;
            bottomLeftBrush.RadiusY = 1.0;
            bottomLeftBrush.Freeze();
        }
开发者ID:aliaspilote,项目名称:TX52,代码行数:39,代码来源:ShadowChrome.cs

示例4: DrawHeatMap

        private void DrawHeatMap()
        {
            ClearRenderTargetBitmap(_heatMap, Brushes.Black);
            if (_sensorsToUse.Count == 0)
            {
                Common.ShowMessageBox("Can't render", "You haven't selected any sensors to render the heatmap from",
                                      false, true);
                return;
            }

            var width = _heatMap.Width;
            var height = _heatMap.Height;

            var depths = _sensorsToUse.Select(x => x.Elevation).Distinct().OrderBy(x => x).ToArray();

            MinDepth = depths.Min();
            MaxDepth = depths.Max();

            if (!SpecifyRadiusEnabled)
                Radius = (float)height / (depths.Count() - 1) / 2;
            Debug.Print("Radius: {0}", Radius);

            var depthRange = MaxDepth - MinDepth;

            var heightMultiplier = height / (depths.Count() - 1);

            Debug.Print("Depth Min {0} Max {1} Range {2} Multiplier {3}", MinDepth, MaxDepth, depthRange, heightMultiplier);

            var timeStamps = _sensorsToUse.SelectMany(x => x.CurrentState.Values).Select(x => x.Key).ToArray();

            if (!SpecifyMinTimestampEnabled)
                MinTimestamp = timeStamps.Min();
            if (!SpecifyMaxTimestampEnabled)
                MaxTimestamp = timeStamps.Max();

            //No longer need timestamps
            timeStamps = null;

            var timeRange = MaxTimestamp - MinTimestamp;

            var widthMultiplier = width / timeRange.TotalMinutes;

            Debug.Print("Time Min {0} Max {1} Range {2} Multiplier {3}", MinTimestamp, MaxTimestamp, timeRange, widthMultiplier);

            if (!SpecifySamplingRateEnabled)
                SamplingRate = (int)(1 / widthMultiplier) * 2;

            var values = _sensorsToUse.SelectMany(x => x.CurrentState.Values).Select(x => x.Value).ToArray();

            if (!SpecifyMinValueEnabled)
                MinValue = values.Min();
            if (!SpecifyMaxValueEnabled)
                MaxValue = values.Max();

            values = null;

            var valuesRange = MaxValue - MinValue;

            var valuesMultiplier = 255 / valuesRange;

            Debug.Print("Values Min {0} Max {1} Range {2} Multiplier {3}", MinValue, MaxValue, valuesRange, valuesMultiplier);
            _depths = new List<DepthYValue>();
            foreach (var sensor in _sensorsToUse)
            {
                var y = (Array.IndexOf(depths, sensor.Elevation) * heightMultiplier);
                _depths.Add(new DepthYValue(sensor.Elevation, y));
                foreach (var timeStamp in sensor.CurrentState.Values.OrderBy(x => x.Key).Where((x, index) => index % SamplingRate == 0))
                {
                    var intensity = (byte)((timeStamp.Value - MinValue) * valuesMultiplier);
                    var radialGradientBrush = new RadialGradientBrush();
                    radialGradientBrush.GradientStops.Add(new GradientStop(Color.FromArgb(intensity, 255, 255, 255), 0.0));
                    radialGradientBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0, 255, 255, 255), 1));
                    radialGradientBrush.Freeze();

                    var x = ((timeStamp.Key - MinTimestamp).TotalMinutes * widthMultiplier) - Radius;

                    //Debug.Print("Point Timestamp {0} Value {1} Depth {2} Intensity {3} x {4} y {5}", timeStamp.Key, timeStamp.Value, sensor.Depth, intensity, x, y - Radius);

                    var drawingVisual = new DrawingVisual();
                    using (var context = drawingVisual.RenderOpen())
                    {
                        context.DrawRectangle(radialGradientBrush, null, new Rect(x, y - Radius, Radius * 2, Radius * 2));
                    }
                    _heatMap.Render(drawingVisual);
                }
            }
        }
开发者ID:rwlamont,项目名称:AllItUp,代码行数:87,代码来源:HeatMapViewModel.cs

示例5: GetResourceKeyValues

 public override IEnumerable<Tuple<object, object>> GetResourceKeyValues(MyHighlightingColor hlColor)
 {
     var br = new RadialGradientBrush() {
         RadiusX = 1,
         RadiusY = 1,
     };
     if (RelativeTransform != null)
         br.RelativeTransform = RelativeTransform;
     if (Center != null)
         br.Center = Center.Value;
     if (GradientOrigin != null)
         br.GradientOrigin = GradientOrigin.Value;
     if (RadiusX != null)
         br.RadiusX = RadiusX.Value;
     if (RadiusY != null)
         br.RadiusY = RadiusY.Value;
     if (Opacity != null)
         br.Opacity = Opacity.Value;
     for (int i = 0; i < GradientOffsets.Length; i++)
         br.GradientStops.Add(new GradientStop(((SolidColorBrush)hlColor.GetHighlightingBrush(i).GetBrush(null)).Color, GradientOffsets[i]));
     br.Freeze();
     yield return new Tuple<object, object>(ResourceKey, br);
 }
开发者ID:se7ensoft,项目名称:dnSpy,代码行数:23,代码来源:Theme.cs

示例6: DisplayPoint

        /// <summary>
        /// Displays a point on the screen in the specified location, with the specified colour.
        /// </summary>
        /// <param name="id">Id of the point.</param>
        /// <param name="p">Position of the point in screen coordinates.</param>
        /// <param name="brushColor">The brush to use for the elipse.</param>
        void DisplayPoint(int id, PointF p, System.Windows.Media.Color brushColor)
        {
            Ellipse e = null;
            if (points.ContainsKey(id))
            {
                e = points[id] as Ellipse;
                e.RenderTransform = new TranslateTransform(p.X - 13, p.Y - 13);
            }

            if (e == null)
            {
                e = new Ellipse();

                RadialGradientBrush radialGradient = new RadialGradientBrush();
                radialGradient.GradientOrigin = new System.Windows.Point(0.5, 0.5);
                radialGradient.Center = new System.Windows.Point(0.5, 0.5);
                radialGradient.RadiusX = 0.5;
                radialGradient.RadiusY = 0.5;

                System.Windows.Media.Color shadow = Colors.Black;
                shadow.A = 30;
                radialGradient.GradientStops.Add(new GradientStop(shadow, 0.9));
                brushColor.A = 60;
                radialGradient.GradientStops.Add(new GradientStop(brushColor, 0.8));
                brushColor.A = 150;
                radialGradient.GradientStops.Add(new GradientStop(brushColor, 0.1));

                radialGradient.Freeze();

                e.Height = 26.0;
                e.Width = 26.0;
                e.Fill = radialGradient;

                int eZ = this.framework.MaxZIndex + 100;
                e.IsHitTestVisible = false;
                e.RenderTransform = new TranslateTransform(p.X - 13, p.Y - 13);
                canvas1.Children.Add(e);
                Panel.SetZIndex(e, eZ);
                points.Add(id, e);
            }
        }
开发者ID:sunghyunL,项目名称:meetingtable2,代码行数:47,代码来源:Window1.xaml.cs

示例7: CreateBrushes

        // Creates an array of brushes needed to render this 
        private static Brush[] CreateBrushes(Color c, CornerRadius cornerRadius)
        {
            Brush[] brushes = new Brush[9];

            // Create center brush
            brushes[Center] = new SolidColorBrush(c);
            brushes[Center].Freeze();



            // Sides
            GradientStopCollection sideStops = CreateStops(c, 0);
            LinearGradientBrush top = new LinearGradientBrush(sideStops, new Point(0, 1), new Point(0, 0));
            top.Freeze();
            brushes[Top] = top;

            LinearGradientBrush left = new LinearGradientBrush(sideStops, new Point(1, 0), new Point(0, 0));
            left.Freeze();
            brushes[Left] = left;

            LinearGradientBrush right = new LinearGradientBrush(sideStops, new Point(0, 0), new Point(1, 0));
            right.Freeze();
            brushes[Right] = right;

            LinearGradientBrush bottom = new LinearGradientBrush(sideStops, new Point(0, 0), new Point(0, 1));
            bottom.Freeze();
            brushes[Bottom] = bottom;

            // Corners

            // Use side stops if the corner radius is 0
            GradientStopCollection topLeftStops;
            if (cornerRadius.TopLeft == 0)
                topLeftStops = sideStops;
            else
                topLeftStops = CreateStops(c, cornerRadius.TopLeft);

            RadialGradientBrush topLeft = new RadialGradientBrush(topLeftStops);
            topLeft.RadiusX = 1;
            topLeft.RadiusY = 1;
            topLeft.Center = new Point(1, 1);
            topLeft.GradientOrigin = new Point(1, 1);
            topLeft.Freeze();
            brushes[TopLeft] = topLeft;

            // Reuse previous stops if corner radius is the same as side or top left
            GradientStopCollection topRightStops;
            if (cornerRadius.TopRight == 0)
                topRightStops = sideStops;
            else if (cornerRadius.TopRight == cornerRadius.TopLeft)
                topRightStops = topLeftStops;
            else
                topRightStops = CreateStops(c, cornerRadius.TopRight);

            RadialGradientBrush topRight = new RadialGradientBrush(topRightStops);
            topRight.RadiusX = 1;
            topRight.RadiusY = 1;
            topRight.Center = new Point(0, 1);
            topRight.GradientOrigin = new Point(0, 1);
            topRight.Freeze();
            brushes[TopRight] = topRight;

            // Reuse previous stops if corner radius is the same as any of the previous radii
            GradientStopCollection bottomLeftStops;
            if (cornerRadius.BottomLeft == 0)
                bottomLeftStops = sideStops;
            else if (cornerRadius.BottomLeft == cornerRadius.TopLeft)
                bottomLeftStops = topLeftStops;
            else if (cornerRadius.BottomLeft == cornerRadius.TopRight)
                bottomLeftStops = topRightStops;
            else
                bottomLeftStops = CreateStops(c, cornerRadius.BottomLeft);

            RadialGradientBrush bottomLeft = new RadialGradientBrush(bottomLeftStops);
            bottomLeft.RadiusX = 1;
            bottomLeft.RadiusY = 1;
            bottomLeft.Center = new Point(1, 0);
            bottomLeft.GradientOrigin = new Point(1, 0);
            bottomLeft.Freeze();
            brushes[BottomLeft] = bottomLeft;

            // Reuse previous stops if corner radius is the same as any of the previous radii
            GradientStopCollection bottomRightStops;
            if (cornerRadius.BottomRight == 0)
                bottomRightStops = sideStops;
            else if (cornerRadius.BottomRight == cornerRadius.TopLeft)
                bottomRightStops = topLeftStops;
            else if (cornerRadius.BottomRight == cornerRadius.TopRight)
                bottomRightStops = topRightStops;
            else if (cornerRadius.BottomRight == cornerRadius.BottomLeft)
                bottomRightStops = bottomLeftStops;
            else
                bottomRightStops = CreateStops(c, cornerRadius.BottomRight);

            RadialGradientBrush bottomRight = new RadialGradientBrush(bottomRightStops);
            bottomRight.RadiusX = 1;
            bottomRight.RadiusY = 1;
            bottomRight.Center = new Point(0, 0);
            bottomRight.GradientOrigin = new Point(0, 0);
//.........这里部分代码省略.........
开发者ID:JianwenSun,项目名称:cc,代码行数:101,代码来源:SystemDropShadowChrome.cs

示例8: CreateFrozenBrush

        protected static RadialGradientBrush CreateFrozenBrush(GradientStopCollection stops, double radX, double radY, Point center, Point origin)
        {
            var brush = new RadialGradientBrush(stops)
            {
                RadiusX = radX,
                RadiusY = radY,
                Center = center,
                GradientOrigin = origin
            };

            brush.Freeze();

            return brush;
        }
开发者ID:HEskandari,项目名称:FarsiLibrary,代码行数:14,代码来源:ButtonChrome.cs

示例9: DisplayPoint

        /// <summary>
        /// Displays a point on the screen in the specified location, with the specified colour.
        /// </summary>
        /// <param name="id">Id of the point.</param>
        /// <param name="p">Position of the point in screen coordinates.</param>
        /// <param name="brushColor">The brush to use for the elipse.</param>
        public void DisplayPoint(int id, PointF p, Color brushColor)
        {
            Ellipse e = null;
            if (_points.ContainsKey(id))
            {
                e = _points[id] as Ellipse;
                e.RenderTransform = new TranslateTransform(p.X - 13, p.Y - 13);
            }

            if (e == null)
            {
                e = new Ellipse();

                var radialGradient = new RadialGradientBrush
                {
                    GradientOrigin = new Point(0.5, 0.5),
                    Center = new Point(0.5, 0.5),
                    RadiusX = 0.5,
                    RadiusY = 0.5
                };

                var shadow = Colors.Black;
                shadow.A = 30;
                radialGradient.GradientStops.Add(new GradientStop(shadow, 0.9));
                brushColor.A = 60;
                radialGradient.GradientStops.Add(new GradientStop(brushColor, 0.8));
                brushColor.A = 150;
                radialGradient.GradientStops.Add(new GradientStop(brushColor, 0.1));

                radialGradient.Freeze();

                e.Height = 26.0;
                e.Width = 26.0;
                e.Fill = radialGradient;

                int eZ = Framework.MaxZIndex + 100;
                e.IsHitTestVisible = false;
                e.RenderTransform = new TranslateTransform(p.X - 13, p.Y - 13);
                Canvas.Children.Add(e);
                Panel.SetZIndex(e, eZ < 600000 ? 600000 : eZ);
                _points.Add(id, e);
            }
        }
开发者ID:realsaraf,项目名称:eConcierge,代码行数:49,代码来源:FrameworkManger.cs

示例10: CreateBrushes

 private static Brush[] CreateBrushes(System.Windows.Media.Color c, System.Windows.CornerRadius cornerRadius)
 {
     GradientStopCollection stops2;
     GradientStopCollection stops3;
     GradientStopCollection stops4;
     GradientStopCollection stops5;
     Brush[] brushArray = new Brush[9];
     brushArray[4] = new SolidColorBrush(c);
     brushArray[4].Freeze();
     GradientStopCollection gradientStopCollection = CreateStops(c, 0.0);
     LinearGradientBrush brush = new LinearGradientBrush(gradientStopCollection, new Point(0.0, 1.0), new Point(0.0, 0.0));
     brush.Freeze();
     brushArray[1] = brush;
     LinearGradientBrush brush2 = new LinearGradientBrush(gradientStopCollection, new Point(1.0, 0.0), new Point(0.0, 0.0));
     brush2.Freeze();
     brushArray[3] = brush2;
     LinearGradientBrush brush3 = new LinearGradientBrush(gradientStopCollection, new Point(0.0, 0.0), new Point(1.0, 0.0));
     brush3.Freeze();
     brushArray[5] = brush3;
     LinearGradientBrush brush4 = new LinearGradientBrush(gradientStopCollection, new Point(0.0, 0.0), new Point(0.0, 1.0));
     brush4.Freeze();
     brushArray[7] = brush4;
     if (cornerRadius.TopLeft == 0.0)
     {
         stops2 = gradientStopCollection;
     }
     else
     {
         stops2 = CreateStops(c, cornerRadius.TopLeft);
     }
     RadialGradientBrush brush5 = new RadialGradientBrush(stops2)
     {
         RadiusX = 1.0,
         RadiusY = 1.0,
         Center = new Point(1.0, 1.0),
         GradientOrigin = new Point(1.0, 1.0)
     };
     brush5.Freeze();
     brushArray[0] = brush5;
     if (cornerRadius.TopRight == 0.0)
     {
         stops3 = gradientStopCollection;
     }
     else if (cornerRadius.TopRight == cornerRadius.TopLeft)
     {
         stops3 = stops2;
     }
     else
     {
         stops3 = CreateStops(c, cornerRadius.TopRight);
     }
     RadialGradientBrush brush6 = new RadialGradientBrush(stops3)
     {
         RadiusX = 1.0,
         RadiusY = 1.0,
         Center = new Point(0.0, 1.0),
         GradientOrigin = new Point(0.0, 1.0)
     };
     brush6.Freeze();
     brushArray[2] = brush6;
     if (cornerRadius.BottomLeft == 0.0)
     {
         stops4 = gradientStopCollection;
     }
     else if (cornerRadius.BottomLeft == cornerRadius.TopLeft)
     {
         stops4 = stops2;
     }
     else if (cornerRadius.BottomLeft == cornerRadius.TopRight)
     {
         stops4 = stops3;
     }
     else
     {
         stops4 = CreateStops(c, cornerRadius.BottomLeft);
     }
     RadialGradientBrush brush7 = new RadialGradientBrush(stops4)
     {
         RadiusX = 1.0,
         RadiusY = 1.0,
         Center = new Point(1.0, 0.0),
         GradientOrigin = new Point(1.0, 0.0)
     };
     brush7.Freeze();
     brushArray[6] = brush7;
     if (cornerRadius.BottomRight == 0.0)
     {
         stops5 = gradientStopCollection;
     }
     else if (cornerRadius.BottomRight == cornerRadius.TopLeft)
     {
         stops5 = stops2;
     }
     else if (cornerRadius.BottomRight == cornerRadius.TopRight)
     {
         stops5 = stops3;
     }
     else if (cornerRadius.BottomRight == cornerRadius.BottomLeft)
     {
         stops5 = stops4;
//.........这里部分代码省略.........
开发者ID:NuPattern,项目名称:NuPattern,代码行数:101,代码来源:VsSystemDropShadowChrome.cs

示例11: BackGradient

        RadialGradientBrush BackGradient()
        {
            RadialGradientBrush rgb
                = new RadialGradientBrush()
                {
                    GradientOrigin = new Point(_rnd.NextDouble(), _rnd.NextDouble()),
                    Center = new Point(_rnd.NextDouble(), _rnd.NextDouble()),
                    RadiusX = _rnd.NextDouble(),
                    RadiusY = _rnd.NextDouble()
                };

            // Beginning of gradient offset
            rgb.GradientStops.Add(
                new GradientStop(new Color()
                {
                    R = (byte)_rnd.Next(255),
                    G = (byte)_rnd.Next(255),
                    B = (byte)_rnd.Next(255),
                    A = 255
                }, 0.0
                    )
                );

            // Scrambled middle gradients
            for (int i = 0; i < _rnd.Next(5); i++)
            {
                rgb.GradientStops.Add(
                    new GradientStop(
                        new Color()
                        {
                            R = (byte)_rnd.Next(255),
                            G = (byte)_rnd.Next(255),
                            B = (byte)_rnd.Next(255),
                            A = 255
                        }
                            , _rnd.NextDouble()
                            )
                        );
            }

            // Ending of gradient offset
            rgb.GradientStops.Add(
                new GradientStop(
                    new Color()
                    {
                        R = (byte)_rnd.Next(255),
                        G = (byte)_rnd.Next(255),
                        B = (byte)_rnd.Next(255),
                        A = 255
                    }, 1.0
                    )
                );

            rgb.Freeze();

            return rgb;
        }
开发者ID:aprovodi,项目名称:HappyFriendMemoryGame,代码行数:57,代码来源:MemoryGameView.xaml.cs

示例12: Show


//.........这里部分代码省略.........
                            height = h;
                        }
                    }

                    if (height > 0)
                    {
                        height -= 11;
                    }

                    if (size1.Width > maxSize.Width)
                    {
                        maxSize.Width = size1.Width;
                    }

                    if (size1.Height + height > maxSize.Height)
                    {
                        maxSize.Height = size1.Height + height;
                    }
                }

                maxSize.Width = maxSize.Width * this.maxScale;
                maxSize.Height = maxSize.Height * this.maxScale;
            }

            this.sourceSize = this.targetSize = balloonSize;
            this.targetOpacity = 1;
            this.targetScaleX = this.targetScaleY = 1;

            Geometry roundedRectangleGeometry = CreateRoundedRectangleGeometry(new Rect(0, 0, this.sourceSize.Width, this.sourceSize.Height - 11 + 4), 8, 8);
            Geometry balloonGeometry = CreateBalloonGeometry(new Rect(4, 4, this.sourceSize.Width - 4 * 2, this.sourceSize.Height - 4), 8 * 3 / 4, 8 * 3 / 4);
            Geometry highlightGeometry = CreateHighlightGeometry(new Rect(0, 0, this.sourceSize.Width, this.baseHeaderHeight + 8), 8, 8);
            Geometry highlightLineGeometry = CreateHighlightLineGeometry(new Rect(0, 0, this.sourceSize.Width, 8), 8, 8);

            if (roundedRectangleGeometry.CanFreeze)
            {
                roundedRectangleGeometry.Freeze();
            }

            if (balloonGeometry.CanFreeze)
            {
                balloonGeometry.Freeze();
            }

            if (highlightGeometry.CanFreeze)
            {
                highlightGeometry.Freeze();
            }

            if (highlightLineGeometry.CanFreeze)
            {
                highlightLineGeometry.Freeze();
            }

            GeometryGroup geometryGroup = new GeometryGroup();

            geometryGroup.FillRule = FillRule.Nonzero;
            geometryGroup.Children.Add(roundedRectangleGeometry);
            geometryGroup.Children.Add(balloonGeometry);

            if (geometryGroup.CanFreeze)
            {
                geometryGroup.Freeze();
            }

            RadialGradientBrush radialGradientBrush = new RadialGradientBrush();
            GradientStop gradientStop1 = new GradientStop(Color.FromArgb(Byte.MaxValue, Byte.MaxValue, Byte.MaxValue, Byte.MaxValue), 0);
开发者ID:kawatan,项目名称:Apricot,代码行数:67,代码来源:Balloon.xaml.cs

示例13: OnRendering


//.........这里部分代码省略.........
                                                {
                                                    if (this.hoverEmbeddedIndex.HasValue && this.hoverEmbeddedIndex.Value == inlineIndex1)
                                                    {
                                                        scrollStep = new Nullable<double>(1);
                                                        this.embedScrollStepDictionary.Add(inlineIndex1, 1);
                                                    }
                                                }
                                                else
                                                {
                                                    scrollStep = new Nullable<double>(step);
                                                    this.embedScrollStepDictionary.Add(inlineIndex1, step);
                                                }
                                            }

                                            if (this.embedColorStepDictionary.TryGetValue(inlineIndex1, out step2))
                                            {
                                                if (isReady && this.nextHistoryPoint.HasValue)
                                                {
                                                    if (!this.embedScrollStepDictionary.ContainsKey(inlineIndex1))
                                                    {
                                                        step2 -= 1 / (averageFrameRate / 4);
                                                    }

                                                    if (step2 <= 0)
                                                    {
                                                        entry = null;
                                                        isMutable = true;
                                                        this.embedColorStepDictionary.Remove(inlineIndex1);
                                                    }
                                                    else if (step2 < 1)
                                                    {
                                                        brush = new SolidColorBrush(Color.FromArgb((byte)(this.textColor.A + (this.linkColor.A - this.textColor.A) * Math.Sin(step2 / 2 * Math.PI)), (byte)(this.textColor.R + (this.linkColor.R - this.textColor.R) * Math.Sin(step2 / 2 * Math.PI)), (byte)(this.textColor.G + (this.linkColor.G - this.textColor.G) * Math.Sin(step2 / 2 * Math.PI)), (byte)(this.textColor.B + (this.linkColor.B - this.textColor.B) * Math.Sin(step2 / 2 * Math.PI))));

                                                        if (brush.CanFreeze)
                                                        {
                                                            brush.Freeze();
                                                        }

                                                        isMutable = true;
                                                        this.embedColorStepDictionary[inlineIndex1] = step2;
                                                    }
                                                    else
                                                    {
                                                        brush = this.linkBrush;
                                                    }
                                                }
                                                else if (step2 < 1)
                                                {
                                                    step2 += 1 / (averageFrameRate / 4);

                                                    if (step2 >= 1)
                                                    {
                                                        brush = this.linkBrush;
                                                        isMutable = true;
                                                        this.embedColorStepDictionary[inlineIndex1] = 1;
                                                    }
                                                    else
                                                    {
                                                        brush = new SolidColorBrush(Color.FromArgb((byte)(this.textColor.A + (this.linkColor.A - this.textColor.A) * Math.Sin(step2 / 2 * Math.PI)), (byte)(this.textColor.R + (this.linkColor.R - this.textColor.R) * Math.Sin(step2 / 2 * Math.PI)), (byte)(this.textColor.G + (this.linkColor.G - this.textColor.G) * Math.Sin(step2 / 2 * Math.PI)), (byte)(this.textColor.B + (this.linkColor.B - this.textColor.B) * Math.Sin(step2 / 2 * Math.PI))));

                                                        if (brush.CanFreeze)
                                                        {
                                                            brush.Freeze();
                                                        }

                                                        isMutable = true;
开发者ID:kawatan,项目名称:Apricot,代码行数:67,代码来源:Balloon.xaml.cs


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