• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Media.Color类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ReplaceColors_ReplacesBackgroundColorsCorrectly

        public void ReplaceColors_ReplacesBackgroundColorsCorrectly()
        {
            // Arrange
            var oldColor = new Color {A = 255, R = 255, G = 0, B = 0};
            var newColor = new Color {A = 255, R = 0, G = 255, B = 100};

            var testInputReplaceColors = new ReplaceColorsParameterSet
            {
                OldBackgroundColor = oldColor,
                NewBackgroundColor = newColor,
                ReplaceBackgroundColor = true
            };

            var testInputBlock1 = new ItemFilterBlock();
            testInputBlock1.BlockItems.Add(new BackgroundColorBlockItem(new Color {A = 255, R = 255, G = 0, B = 0}));
            var testInputBlock2 = new ItemFilterBlock();
            testInputBlock2.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 255, R = 255, G = 1, B = 0 }));
            var testInputBlock3 = new ItemFilterBlock();
            testInputBlock3.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 255, R = 255, G = 0, B = 0 }));

            var script = new ItemFilterScript();

            script.ItemFilterBlocks.Add(testInputBlock1);
            script.ItemFilterBlocks.Add(testInputBlock2);
            script.ItemFilterBlocks.Add(testInputBlock3);

            // Act
            script.ReplaceColors(testInputReplaceColors);

            // Assert
            Assert.AreEqual(newColor, testInputBlock1.BlockItems.OfType<BackgroundColorBlockItem>().First().Color);
            Assert.AreNotEqual(newColor, testInputBlock2.BlockItems.OfType<BackgroundColorBlockItem>().First().Color);
            Assert.AreEqual(newColor, testInputBlock3.BlockItems.OfType<BackgroundColorBlockItem>().First().Color);
        }
开发者ID:BourbonCrow,项目名称:Filtration,代码行数:34,代码来源:TestItemFilterScript.cs


示例17: Prim

 public Prim(Color init, Color edgefinal, Color edgetemp, Color nodefinal)
 {
     initColor = new SolidColorBrush(init);
     edgeFinalColor = new SolidColorBrush(edgefinal);
     edgeTempColor = new SolidColorBrush(edgetemp);
     nodeFinalColor = new SolidColorBrush(nodefinal);
 }
开发者ID:daymonc,项目名称:Draw_Graph,代码行数:7,代码来源:Prim.cs


示例18: BilinearInterpolate

        /// <summary>
        /// Bilinear interpolation of ARGB values.
        /// </summary>
        /// <param name="x">The X interpolation parameter 0..1</param>
        /// <param name="y">The y interpolation parameter 0..1</param>
        /// <param name="nw"></param>
        /// <param name="ne"></param>
        /// <param name="sw"></param>
        /// <param name="se"></param>
        /// <returns>The interpolated value.</returns>
        public static Color BilinearInterpolate(double x, double y, Color nw, Color ne, Color sw, Color se)
        {
            double cx = 1.0 - x;
            double cy = 1.0 - y;

            //nw = ColorUtility.PreMultiplyAlpha(nw);
            //ne = ColorUtility.PreMultiplyAlpha(ne);
            //sw = ColorUtility.PreMultiplyAlpha(sw);
            //se = ColorUtility.PreMultiplyAlpha(se);

            double m0 = cx * nw.A + x * ne.A;
            double m1 = cx * sw.A + x * se.A;
            byte a = (byte)(cy * m0 + y * m1);

            m0 = cx * nw.R + x * ne.R;
            m1 = cx * sw.R + x * se.R;
            byte r = (byte)(cy * m0 + y * m1);

            m0 = cx * nw.G + x * ne.G;
            m1 = cx * sw.G + x * se.G;
            byte g = (byte)(cy * m0 + y * m1);

            m0 = cx * nw.B + x * ne.B;
            m1 = cx * sw.B + x * se.B;
            byte b = (byte)(cy * m0 + y * m1);

            Color result = Color.FromArgb(a, r, g, b);
            //result = ColorUtility.UnPreMultiplyAlpha(result);
            return result;
        }
开发者ID:sitdap,项目名称:dynamic-image,代码行数:40,代码来源:ImageMath.cs


示例19: TileProperty

 public TileProperty(int id, string name, Color color, bool isFramed = false)
 {
     _color = color;
     _id = id;
     _name = name;
     _isFramed = isFramed;
 }
开发者ID:KeviinSkyline,项目名称:Terraria-Map-Editor,代码行数:7,代码来源:TileProperty.cs


示例20: GetStyle

 public override TileStyle GetStyle(Color tileColor, Color fontColor)
 {
     var style = GetDefaultStyle();
     style.Font.Color = new SolidColorBrush(fontColor);
     style.Shape.Fill = new SolidColorBrush(tileColor);
     return style;
 }
开发者ID:hubbardgary,项目名称:NumberWang,代码行数:7,代码来源:EightsStyles.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Media.CompositeTransform类代码示例发布时间:2022-05-26
下一篇:
C# Media.BrushConverter类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap