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


C# Media.Color类代码示例

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


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

示例1: CreateBlockBox

        public static Border CreateBlockBox(FrameworkElement child, double width, double height, double x, double y, Color backgroundColor)
        {
            var border = new Border()
            {
                BorderThickness = new Thickness(1, 1, 1, 1),
                BorderBrush = Brushes.Silver,
                Background = new SolidColorBrush(backgroundColor),

                Width = width,
                Height = height,
                Margin = new Thickness(x, y, 0, 0),
                Child = child
            };

            border.MouseEnter += (s, e) =>
            {
                border.Width = Math.Max(width, child.ActualWidth);
                border.Height = Math.Max(height, child.ActualHeight);
                Panel parent = (Panel)border.Parent;
                border.TopMost();
            };

            border.MouseLeave += (s, e) =>
            {
                border.Width = width;
                border.Height = height;
            };

            return border;
        }
开发者ID:breslavsky,项目名称:queue,代码行数:30,代码来源:QueueMonitorControl.xaml.cs

示例2: CellColorActionViewModel

 public CellColorActionViewModel(string name, string description, char code, Color backgroundColor)
 {
     Name = name;
     Description = description;
     Code = code;
     BackgroundBrush = new SolidColorBrush(backgroundColor);
 }
开发者ID:evilz,项目名称:algorithm-datastructure,代码行数:7,代码来源:CellColorActionViewModel.cs

示例3: Dipolar

 public static IColorSequence Dipolar(Color negativeColor, Color positiveColor, int halfStepCount)
 {
     return new Ir1ColorSequence(
             new ColorSequenceImpl(positiveColor.LessFadingSpread(halfStepCount)),
             new ColorSequenceImpl(negativeColor.LessFadingSpread(halfStepCount))
         );
 }
开发者ID:tp-nscan,项目名称:BunnyMf,代码行数:7,代码来源:ColorSequence.cs

示例4: ToGradient

        /// <summary>Creates a gradient brush with the given colors flowing in the specified direction.</summary>
        /// <param name="direction">The direction of the gradient.</param>
        /// <param name="start">The starting color.</param>
        /// <param name="end">The ending color.</param>
        public static LinearGradientBrush ToGradient(this Direction direction, Color start, Color end)
        {
            // Create the brush.
            var brush = new LinearGradientBrush();
            switch (direction)
            {
                case Direction.Down:
                case Direction.Up:
                    brush.StartPoint = new Point(0.5, 0);
                    brush.EndPoint = new Point(0.5, 1);
                    break;
                case Direction.Right:
                case Direction.Left:
                    brush.StartPoint = new Point(0, 0.5);
                    brush.EndPoint = new Point(1, 0.5);
                    break;
            }

            // Configure colors.
            var gradientStart = new GradientStop { Color = start };
            var gradientEnd = new GradientStop { Color = end };

            gradientStart.Offset = direction == Direction.Up || direction == Direction.Left ? 1 : 0;
            gradientEnd.Offset = direction == Direction.Down || direction == Direction.Right ? 1 : 0;

            // Insert colors.
            brush.GradientStops.Add(gradientStart);
            brush.GradientStops.Add(gradientEnd);

            // Finish up.
            return brush;
            
        }
开发者ID:philcockfield,项目名称:Open.TestHarness.SL,代码行数:37,代码来源:ColorExtensions.cs

示例5: CustomStartEndLineStyle

 public CustomStartEndLineStyle(PointSymbolType startType, Color startColor, int startSize,
                                PointSymbolType endType, Color endColor, int endSize,
                                Color lineColor, float lineSize)
     : this(new PointStyle(startType, new GeoSolidBrush(GeoColor.FromArgb(startColor.A, startColor.R, startColor.G, startColor.B)), startSize),
            new PointStyle(endType, new GeoSolidBrush(GeoColor.FromArgb(endColor.A, endColor.R, endColor.G, endColor.B)), endSize),
            new LineStyle(new GeoPen(GeoColor.FromArgb(lineColor.A, lineColor.R, lineColor.G, lineColor.B), lineSize)))
 { }
开发者ID:AuditoryBiophysicsLab,项目名称:ESME-Workbench,代码行数:7,代码来源:CustomStartEndLineStyle.cs

示例6: AdministrationViewModel

 public AdministrationViewModel(ICustomAppearanceManager appearanceManager, IAppSettings appSettings)
 {
     this.appearanceManager = appearanceManager;
     this.appSettings = appSettings;
     selectedAccentColor = appearanceManager.AccentColor;
     selectedTextColor = appearanceManager.TextColor;
 }
开发者ID:silverforge,项目名称:TwitterClient,代码行数:7,代码来源:AdministrationViewModel.cs

示例7: LogFile

 public LogFile(string path, Color color, string timestampPattern, LogOffset offset)
 {
     Path = path;
     Color = color;
     TimestampPattern = timestampPattern;
     Offset = offset;
 }
开发者ID:simoneb,项目名称:lsight,代码行数:7,代码来源:LogFile.cs

示例8: AlternatingListBoxBackground

        public AlternatingListBoxBackground(Color color1, Color color2)
        {
            var setter = new Setter();
            setter.Property = ListBoxItem.BackgroundProperty;
            setter.Value = new SolidColorBrush(color1);

            var trigger = new Trigger();
            trigger.Property = ItemsControl.AlternationIndexProperty;
            trigger.Value = 0;
            trigger.Setters.Add(setter);

            var setter2 = new Setter();
            setter2.Property = ListBoxItem.BackgroundProperty;
            setter2.Value = new SolidColorBrush(color2);

            var trigger2 = new Trigger();
            trigger2.Property = ItemsControl.AlternationIndexProperty;
            trigger2.Value = 1;
            trigger2.Setters.Add(setter2);

            var listBoxStyle = new Style(typeof(ListBoxItem));
            listBoxStyle.Triggers.Add(trigger);
            listBoxStyle.Triggers.Add(trigger2);

            _listBoxStyle = listBoxStyle;
        }
开发者ID:Danmer,项目名称:uberdemotools,代码行数:26,代码来源:ListBoxHelper.cs

示例9: ColorRange

 public ColorRange(Color lowColor, Color highColor, float lowHeight, float highHeight)
 {
     LowColor = lowColor;
     HighColor = highColor;
     LowHeight = lowHeight;
     HighHeight = highHeight;
 }
开发者ID:deanljohnson,项目名称:EnviroGen,代码行数:7,代码来源:ColorRange.cs

示例10: Dijkstra

 public Dijkstra(Color main, Color temp, Color search, Color next)
 {
     mainColor=new SolidColorBrush(main);
     tempColor=new SolidColorBrush(temp);
     nextColor=new SolidColorBrush(next);
     searchColor=new SolidColorBrush(search);
 }
开发者ID:daymonc,项目名称:Draw_Graph,代码行数:7,代码来源:Dijkstra.cs

示例11: DrawingToMediaColor

    } // DrawingToMediaColor()

    /// <summary>
    /// Converts a System.Windows.Media.Color value to a
    /// System.Drawing.Color value.
    /// </summary>
    /// <param name="color">A System.Windows.Media.Color value.</param>
    /// <returns>A System.Drawing.Color value.</returns>
    public static System.Drawing.Color MediaToDrawingColor(Color color)
    {
      System.Drawing.Color colorNew = System.Drawing.Color.FromArgb(
        color.A, color.R, color.G, color.B);
      
      return colorNew;
    } // MediaToDrawingColor()
开发者ID:xtxgd,项目名称:Tethys.Silverlight,代码行数:15,代码来源:Conversion.cs

示例12: Color

 /// <summary>
 /// Initializes a new instance of the <see cref="Color"/> class.
 /// </summary>
 /// <param name="mediaColor">The color.</param>
 /// <param name="invariantName">The culture-insensitive name of the color. (Optional.)</param>
 /// <param name="name">The localized friendly name of the color. (Optional.)</param>
 /// <param name="isBuiltIn">A value indicating whether this color is defined in the assembly. (Optional.)</param>
 public Color(System.Windows.Media.Color mediaColor, string invariantName = null, string name = null, bool isBuiltIn = false)
 {
     this.name = name;
     this.identifier = isBuiltIn ? ("resource:" + invariantName) : ("color:" + mediaColor);
     this.isBuiltIn = isBuiltIn;
     this.mediaColor = mediaColor;
 }
开发者ID:ZhuXiaomin,项目名称:Hourglass,代码行数:14,代码来源:Color.cs

示例13: DualBrushes

 public static IZ1BrushSequence DualBrushes(Color positiveColor, Color negativeColor, int steps)
 {
     return new Z1BrushSequence(
         positiveBrushes: positiveColor.FadingSpread(steps + 1).ToBrushes(),
         negativeBrushes: negativeColor.FadingSpread(steps + 1).ToBrushes()
     );
 }
开发者ID:tp-nscan,项目名称:BunnyMf,代码行数:7,代码来源:BrushSequence.cs

示例14: CleanCodeRank

 public CleanCodeRank(Color color, string name)
 {
     Color = new SolidColorBrush(color);
     Name = "  " + name;
     Principles = new ObservableCollection<CleanCodePrinciple>();
     Practices = new ObservableCollection<CleanCodePractice>();
 }
开发者ID:halllo,项目名称:MTSS12,代码行数:7,代码来源:CleanCodeRank.cs

示例15: ErrorTextMarker

 public ErrorTextMarker(int startOffset, int length, string message, Color markerColor)
 {
     StartOffset = startOffset;
     Length = length;
     Message = message;
     MarkerColor = markerColor;
 }
开发者ID:jhorv,项目名称:dotnetpad,代码行数:7,代码来源:ErrorTextMarker.cs


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