當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。