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


C# SolidColorBrush.GetCurrentValueAsFrozen方法代码示例

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


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

示例1: _GetGrayscaleBrush

        /// <summary>
        /// Gets grayscale brush from color.
        /// </summary>
        /// <param name="originalColor">Input color.</param>
        /// <returns>Brush with converted grayscale color.</returns>
        private static SolidColorBrush _GetGrayscaleBrush(System.Drawing.Color originalColor)
        {
            Color grayscaleColor = new Color();

            double R = Convert.ToDouble(originalColor.R);
            double G = Convert.ToDouble(originalColor.G);
            double B = Convert.ToDouble(originalColor.B);

            grayscaleColor.A = originalColor.A;

            // Convert original color to grayscale.
            grayscaleColor.R = Convert.ToByte((R + G + B) / GRAYSCALE_CONVERTER_PARAMETER);
            grayscaleColor.G = Convert.ToByte((R + G + B) / GRAYSCALE_CONVERTER_PARAMETER);
            grayscaleColor.B = Convert.ToByte((R + G + B) / GRAYSCALE_CONVERTER_PARAMETER);

            SolidColorBrush resultBrush = new SolidColorBrush(grayscaleColor);

            // Freeze brush.
            resultBrush = (SolidColorBrush)resultBrush.GetCurrentValueAsFrozen();
            Debug.Assert(resultBrush != null);

            return resultBrush;
        }
开发者ID:erindm,项目名称:route-planner-csharp,代码行数:28,代码来源:GanttControlHelper.cs

示例2: _CreateRouteCanvas

        /// <summary>
        /// Creates canvas with invalidated route and its stops.
        /// </summary>
        /// <param name="route">Route to draw.</param>
        /// <param name="sortedRouteStops">Sorted stops from route.</param>
        /// <param name="mapImage">Map image.</param>
        /// <returns>Canvas with invalidated route and its stops.</returns>
        private SysControls.Canvas _CreateRouteCanvas(Route route, IList<Stop> sortedRouteStops, MapImage mapImage)
        {
            Debug.Assert(null != route);
            Debug.Assert(null != mapImage);
            Debug.Assert(null != sortedRouteStops);

            // create canvas
            var canvas = new SysControls.Canvas();
            canvas.InvalidateVisual();
            canvas.Height = mapImage.ImageHeight;
            canvas.Width = mapImage.ImageWidth;

            // init route brush from route color
            System.Drawing.Color color = route.Color;
            var mediaColor =
                SysWindows.Media.Color.FromArgb(color.A, color.R, color.G, color.B);
            var fillingBrush = new SolidColorBrush(mediaColor);

            // create and init route image
            SymbolControl routeBox = new SymbolControl(_routeSymbolTemplate);
            routeBox.Geometry = _CreatePath(route,
                                            sortedRouteStops,
                                            mapImage.Extent,
                                            mapImage.ImageWidth,
                                            mapImage.ImageHeight);
            routeBox.Fill = (SolidColorBrush)fillingBrush.GetCurrentValueAsFrozen();
            routeBox.HorizontalAlignment = HorizontalAlignment.Stretch;
            routeBox.VerticalAlignment = VerticalAlignment.Stretch;
            // draw route
            canvas.Children.Add(routeBox);

            // draw stops - from last to first (visual elements)
            int stopLastIndex = sortedRouteStops.Count - 1;
            for (int index = stopLastIndex; index >= 0; --index)
            {
                Stop stop = sortedRouteStops[index];
                if (!stop.MapLocation.HasValue)
                    continue; // skip empty

                bool isVisible = true;
                if (stop.AssociatedObject is Location)
                {
                    if (index == 0)
                    {
                        isVisible = _showLeadingStemTime;
                    }
                    else if (index == stopLastIndex)
                    {
                        isVisible = _showTrailingStemTime;
                    }
                    // else do nothing
                }

                if (isVisible)
                {
                    UIElement element = _CreateStopUIElement(stop, mapImage, fillingBrush);
                    if (element != null)
                        canvas.Children.Add(element);
                }
            }

            return canvas;
        }
开发者ID:erindm,项目名称:route-planner-csharp,代码行数:70,代码来源:MapImageExporter.cs

示例3: _GetFillBrush

        /// <summary>
        /// Defines fill brush.
        /// </summary>
        /// <param name="parentColor">Parent color.</param>
        /// <returns>Normal fill brush</returns>
        private static SolidColorBrush _GetFillBrush(System.Drawing.Color parentColor)
        {
            Color color = new Color();

            color.A = parentColor.A;
            color.R = parentColor.R;
            color.G = parentColor.G;
            color.B = parentColor.B;

            SolidColorBrush resultBrush = new SolidColorBrush(color);

            // Freeze brush.
            resultBrush = (SolidColorBrush)resultBrush.GetCurrentValueAsFrozen();

            Debug.Assert(resultBrush != null);

            return resultBrush;
        }
开发者ID:erindm,项目名称:route-planner-csharp,代码行数:23,代码来源:GanttControlHelper.cs

示例4: GetSelectedBrush

        /// <summary>
        /// Returns selected brush.
        /// </summary>
        /// <returns>Selected brush.</returns>
        public static Brush GetSelectedBrush()
        {
            if (_selectionBrush == null)
            {
                _selectionBrush = (SolidColorBrush)Application.Current.FindResource(SELECTION_COLOR_NAME);
                _selectionBrush = (SolidColorBrush)_selectionBrush.GetCurrentValueAsFrozen();
            }

            return _selectionBrush;
        }
开发者ID:erindm,项目名称:route-planner-csharp,代码行数:14,代码来源:GanttControlHelper.cs

示例5: GetLocationBrush

        /// <summary>
        /// Returns location brush.
        /// </summary>
        /// <returns>Location brush.</returns>
        public static Brush GetLocationBrush()
        {
            if (_locationBrush == null)
            {
                _locationBrush = (SolidColorBrush)Application.Current.FindResource(LOCATION_COLOR_SOURCE_NAME);
                _locationBrush = (SolidColorBrush)_locationBrush.GetCurrentValueAsFrozen();
            }

            return _locationBrush;
        }
开发者ID:erindm,项目名称:route-planner-csharp,代码行数:14,代码来源:GanttControlHelper.cs

示例6: GetDragOverBrush

        /// <summary>
        /// Returns drag over brush.
        /// </summary>
        /// <returns>Drag over brush.</returns>
        public static Brush GetDragOverBrush()
        {
            if (_dragOverBrush == null)
            {
                _dragOverBrush = (SolidColorBrush)Application.Current.FindResource(DRAG_OVER_COLOR_NAME);
                _dragOverBrush = (SolidColorBrush)_dragOverBrush.GetCurrentValueAsFrozen();
            }

            return _dragOverBrush;
        }
开发者ID:erindm,项目名称:route-planner-csharp,代码行数:14,代码来源:GanttControlHelper.cs

示例7: GetBreakBrush

        /// <summary>
        /// Returns break brush.
        /// </summary>
        /// <returns>Break brush.</returns>
        public static Brush GetBreakBrush()
        {
            if (_breakBrush == null)
            {
                _breakBrush = (SolidColorBrush)Application.Current.FindResource(BREAK_COLOR_SOURCE_NAME);
                _breakBrush = (SolidColorBrush)_breakBrush.GetCurrentValueAsFrozen();
            }

            return _breakBrush;
        }
开发者ID:erindm,项目名称:route-planner-csharp,代码行数:14,代码来源:GanttControlHelper.cs


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