當前位置: 首頁>>代碼示例>>C#>>正文


C# Media.SolidColorBrush類代碼示例

本文整理匯總了C#中System.Windows.Media.SolidColorBrush的典型用法代碼示例。如果您正苦於以下問題:C# SolidColorBrush類的具體用法?C# SolidColorBrush怎麽用?C# SolidColorBrush使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SolidColorBrush類屬於System.Windows.Media命名空間,在下文中一共展示了SolidColorBrush類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PkgCreateWin

 public PkgCreateWin()
 {
     InitializeComponent();
     EnabledColor = SnapshotBtn.Foreground;
     DisabledColor =  new SolidColorBrush(System.Windows.Media.Colors.LightGray);
     SetUiMode(UiMode.WaitingForFile);
 }
開發者ID:vaginessa,項目名稱:cameyo,代碼行數:7,代碼來源:PkgCreateWin.xaml.cs

示例2: Create

        public Model3DGroup Create(Color modelColor,string pictureName, Point3D startPos, double maxHigh)
        {
            try
            {
                Uri inpuri = new Uri(@pictureName, UriKind.Relative);
                BitmapImage bi = new BitmapImage();
                bi.BeginInit();
                bi.UriSource = inpuri;
                bi.EndInit();
                ImageBrush imagebrush = new ImageBrush(bi);
                imagebrush.Opacity = 100;
                imagebrush.Freeze();

                Point[] ptexture0 = { new Point(0, 0), new Point(0, 1), new Point(1, 0) };
                Point[] ptexture1 = { new Point(1, 0), new Point(0, 1), new Point(1, 1) };

                SolidColorBrush modelbrush = new SolidColorBrush(modelColor);
                Model3DGroup cube = new Model3DGroup();
                Point3D uppercircle = startPos;
                modelbrush.Freeze();
                uppercircle.Y = startPos.Y + maxHigh;
                cube.Children.Add(CreateEllipse2D(modelbrush, uppercircle, _EllipseHigh, new Vector3D(0, 1, 0)));
                cube.Children.Add(CreateEllipse2D(modelbrush, startPos, _EllipseHigh, new Vector3D(0, -1, 0)));
                cube.Children.Add(CreateEllipse3D(imagebrush, startPos, _EllipseHigh, maxHigh, ptexture0));
                return cube;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
開發者ID:kse-jp,項目名稱:RM-3000,代碼行數:31,代碼來源:EllipseModel.cs

示例3: WatchViewFullscreen

        public WatchViewFullscreen()
        {
            InitializeComponent();

            MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(view_MouseButtonIgnore);
            MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(view_MouseButtonIgnore);
            MouseRightButtonUp += new System.Windows.Input.MouseButtonEventHandler(view_MouseRightButtonUp);
            PreviewMouseRightButtonDown += new System.Windows.Input.MouseButtonEventHandler(view_PreviewMouseRightButtonDown);

            MenuItem mi = new MenuItem();
            mi.Header = "Zoom to Fit";
            mi.Click += new RoutedEventHandler(mi_Click);

            MainContextMenu.Items.Add(mi);

            System.Windows.Shapes.Rectangle backgroundRect = new System.Windows.Shapes.Rectangle();
            Canvas.SetZIndex(backgroundRect, -10);
            backgroundRect.IsHitTestVisible = false;
            BrushConverter bc = new BrushConverter();
            Brush strokeBrush = (Brush)bc.ConvertFrom("#313131");
            backgroundRect.Stroke = strokeBrush;
            backgroundRect.StrokeThickness = 1;
            SolidColorBrush backgroundBrush = new SolidColorBrush(System.Windows.Media.Color.FromRgb(250, 250, 216));
            backgroundRect.Fill = backgroundBrush;

            inputGrid.Children.Add(backgroundRect);
        }
開發者ID:romeo08437,項目名稱:Dynamo,代碼行數:27,代碼來源:WatchViewFullscreen.xaml.cs

示例4: WorkshopViewModelBase

 protected WorkshopViewModelBase()
 {
     if (IsInDesignModeStatic)
     {
         Head = "X:123, Y:456, Z:7890";
         Neck = "X:123, Y:456, Z:7890";
         LeftShoulder = "X:123, Y:456, Z:7890";
         RightShoulder = "X:123, Y:456, Z:7890";
         Torso = "X:123, Y:456, Z:7890";
         LeftElbow = "X:123, Y:456, Z:7890";
         RightElbow = "X:123, Y:456, Z:7890";
         LeftHand = "X:123, Y:456, Z:7890";
         RightHand = "X:123, Y:456, Z:7890";
         LeftHand = "X:123, Y:456, Z:7890";
         RightHand = "X:123, Y:456, Z:7890";
         LeftHip = "X:123, Y:456, Z:7890";
         RightHip = "X:123, Y:456, Z:7890";
         LeftKnee = "X:123, Y:456, Z:7890";
         RightKnee = "X:123, Y:456, Z:7890";
         LeftFoot = "X:123, Y:456, Z:7890";
         RightFoot = "X:123, Y:456, Z:7890";
     }
     else
     {
         Kinect = MyKinect.Instance;
         PointerColor = new SolidColorBrush(Color.FromRgb(139, 0, 0));
         Messages = new ObservableCollection<string>();
         Start = new RelayCommand<RoutedEventArgs>(e => SafeStartKinect());
         Stop = new RelayCommand<RoutedEventArgs>(e => SafeStopKinect());
     }
 }
開發者ID:atosorigin,項目名稱:Kinect,代碼行數:31,代碼來源:WorkshopViewModelBase.cs

示例5: PageHeader

        public PageHeader()
        {
            Brush brush = new SolidColorBrush(Colors.DarkGray);
            brush.Opacity = 0.60;

            this.Background = brush;

            Border frameBorder = new Border();
            frameBorder.BorderBrush = Brushes.Gray;
            frameBorder.BorderThickness = new Thickness(2);

            DockPanel panelMain = new DockPanel();
            panelMain.Margin = new Thickness(5, 5, 5, 5);
            panelMain.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            txtText = new TextBlock();
            txtText.FontSize = 32;
            txtText.Margin = new Thickness(5, 0, 0, 0);
            txtText.SetResourceReference(TextBlock.ForegroundProperty, "HeaderTextColor");
            txtText.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            panelMain.Children.Add(txtText);

            frameBorder.Child = panelMain;

            this.Content = frameBorder;
        }
開發者ID:rhgtvcx,項目名稱:tap-desktop,代碼行數:27,代碼來源:PageHeader.cs

示例6: ActivateStack

        public void ActivateStack()
        {
            SolidColorBrush scb = new SolidColorBrush(Colors.Black);
            r_TileRect.Fill = scb;

            c_StackCanvas.IsHitTestVisible = true;
            c_StackCanvas.IsEnabled = true;
            c_StackCanvas.Background = scb;
            c_StackCanvas.BeginAnimation(Canvas.HeightProperty, a_Open);
            c_StackCanvas.BeginAnimation(Canvas.WidthProperty, a_OpenW);

            int posX = xBuff;
            int posY = 40;

            foreach (StackItem si in si_StackItems)
            {
                Canvas.SetLeft(si, posX);
                Canvas.SetTop(si, posY);

                c_StackCanvas.Children.Add(si);

                posX += siWidth;
                if (posX > 300)
                {
                    posX = xBuff;
                    posY += siHeight;
                }
            }

            b_isOpened = true;
            l_StackPath.IsEnabled = true;
            l_StackPath.Visibility = Visibility.Visible;
            l_DecoStack.IsEnabled = true;
            l_DecoStack.Visibility = Visibility.Visible;
        }
開發者ID:Foda,項目名稱:Tide,代碼行數:35,代碼來源:StackTile.xaml.cs

示例7: BackgroundSetThroughCode

 public void BackgroundSetThroughCode()
 {
     GridSplitter splitter = new GridSplitter();
     Brush b = new SolidColorBrush(Colors.Black);
     splitter.Background = b;
     Assert.AreEqual(b, splitter.GetValue(GridSplitter.BackgroundProperty), "Setting Background property should set backing dependency property.");
 }
開發者ID:dfr0,項目名稱:moon,代碼行數:7,代碼來源:GridSplitterTest.cs

示例8: Brique

        //Constructeur
        public Brique(Grid parent, double posX, double posY, bool cassable)
        {
            //Création de l'ellipse
            this._forme = new Rectangle();

            //Ajout au parent
            parent.Children.Add(this._forme);

            //Taille de la Brique
            this._forme.Height = 20;
            this._forme.Width = 60;

            //Position de la Brique
            this._forme.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            this._forme.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            this._forme.Margin = new System.Windows.Thickness(posX, posY, 0, 0);

            this.Cassable = cassable;

            //Couleur de la Brique
            //Couleur de fond
            Thread.Sleep(1);
            Random R = new Random(unchecked((int)DateTime.Now.Ticks));
            SolidColorBrush couleurFond = new SolidColorBrush();
            byte Red = (byte)(R.Next(253) + 1);
            byte Green = (byte)(R.Next(253) + 1);
            byte Blue = (byte)(R.Next(253) + 1);
            //Noire si incassable
            couleurFond.Color = cassable ? Color.FromRgb(Red, Green, Blue) : Color.FromRgb(0, 0, 0);
            this._forme.Fill = couleurFond;
            //Couleur de bordure
            SolidColorBrush couleurBord = new SolidColorBrush();
            couleurBord.Color = Color.FromRgb(255, 255, 255);
            this._forme.Stroke = couleurBord;
        }
開發者ID:mbonitho,項目名稱:ClockTwo,代碼行數:36,代碼來源:Brique.cs

示例9: Convert

 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     SolidColorBrush brush = new SolidColorBrush(Colors.Red);
     if ((bool)value)
         brush = new SolidColorBrush(Colors.Black);
     return brush;
 }
開發者ID:JohnDMathis,項目名稱:Pippin,代碼行數:7,代碼來源:Bool2RedBlack.cs

示例10: ProvideValue

        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            SolidColorBrush brush = new SolidColorBrush(GetColor());

            brush.Freeze();
            return brush;
        }
開發者ID:spiked3,項目名稱:ConeMapper,代碼行數:7,代碼來源:WpfExtensions.cs

示例11: CheckPostalCode

        private void CheckPostalCode()
        {
            if (appSettings.PostalCodeSetting == "")
            {
                PostalCodeSet.Text = "*Required";
                SolidColorBrush Brush1 = new SolidColorBrush();
                Brush1.Color = Colors.Red;
                PostalCodeSet.Foreground = Brush1;
                ValidPC.Visibility = System.Windows.Visibility.Collapsed;
                IsValidPC.Visibility = System.Windows.Visibility.Collapsed;
            }
            else if (!IsPostalCode(appSettings.PostalCodeSetting))
            {
                SolidColorBrush Brush1 = new SolidColorBrush();
                Brush1.Color = Colors.Red;
                PostalCodeSet.Foreground = Brush1;
                PostalCodeSet.Text = appSettings.PostalCodeSetting;
                ValidPC.Visibility = System.Windows.Visibility.Visible;

            }
            else
            {
                PostalCodeSet.Text = appSettings.PostalCodeSetting;
                SolidColorBrush Brush1 = new SolidColorBrush();
                Brush1.Color = Colors.Green;
                PostalCodeSet.Foreground = Brush1;
                ValidPC.Visibility = System.Windows.Visibility.Collapsed;
                IsValidPC.Visibility = System.Windows.Visibility.Collapsed;
            }
        }
開發者ID:john0320,項目名稱:WindowsPhone8Final,代碼行數:30,代碼來源:MainSettings.xaml.cs

示例12: Cabecera

        public Cabecera()
        {
            Background = new SolidColorBrush(Colors.White);
            Orientation = Orientation.Vertical;

            var nombreJuego = new TextBlock { Text = "Tres en Línea", FontSize = 78, Foreground = new SolidColorBrush(Colors.Black), HorizontalAlignment = HorizontalAlignment.Center};
            Children.Add(nombreJuego);

            var nuevoJuego = new Button {Content = "Iniciar nuevo Juego", Background = new SolidColorBrush(Colors.Black)};
            nuevoJuego.Tap += nuevoJuego_Tap;
            Children.Add(nuevoJuego);

            Grid resultadoGrid = new Grid{Background = new SolidColorBrush(Colors.White), ShowGridLines = false};

            resultadoGrid.ColumnDefinitions.Add(new ColumnDefinition());
            resultadoGrid.ColumnDefinitions.Add(new ColumnDefinition{Width = new GridLength(2, GridUnitType.Star)});
            resultadoGrid.RowDefinitions.Add(new RowDefinition());

            var labelResultado = new TextBlock { Text = "Resultado:", FontSize = 22, Foreground = new SolidColorBrush(Colors.Black), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center };
            resultadoGrid.Children.Add(labelResultado);
            Grid.SetColumn(labelResultado, 0);

            resultado = new TextBlock { Text = "En proceso.", FontSize = 22, Foreground = new SolidColorBrush(Colors.Black), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center };
            resultadoGrid.Children.Add(resultado);
            Grid.SetColumn(resultado, 1);

            Children.Add(resultadoGrid);
        }
開發者ID:douglaszuniga,項目名稱:Gato,代碼行數:28,代碼來源:Cabecera.cs

示例13: BottomMargin

        public BottomMargin(IWpfTextView textView, IClassifierAggregatorService classifier, ITextDocumentFactoryService documentService)
        {
            _textView = textView;
            _classifier = classifier.GetClassifier(textView.TextBuffer);
            _foregroundBrush = new SolidColorBrush((Color)FindResource(VsColors.CaptionTextKey));
            _backgroundBrush = new SolidColorBrush((Color)FindResource(VsColors.ScrollBarBackgroundKey));

            this.Background = _backgroundBrush;
            this.ClipToBounds = true;

            _lblEncoding = new TextControl("Encoding");
            this.Children.Add(_lblEncoding);

            _lblContentType = new TextControl("Content type");
            this.Children.Add(_lblContentType);

            _lblClassification = new TextControl("Classification");
            this.Children.Add(_lblClassification);

            _lblSelection = new TextControl("Selection");
            this.Children.Add(_lblSelection);

            UpdateClassificationLabel();
            UpdateContentTypeLabel();
            UpdateContentSelectionLabel();

            if (documentService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out _doc))
            {
                _doc.FileActionOccurred += FileChangedOnDisk;
                UpdateEncodingLabel(_doc);
            }

            textView.Caret.PositionChanged += CaretPositionChanged;
        }
開發者ID:modulexcite,項目名稱:ExtensibilityTools,代碼行數:34,代碼來源:BottomMargin.cs

示例14: for_MouseDown

 private void for_MouseDown(object sender, MouseButtonEventArgs e)
 {
     SolidColorBrush[] brushes = new SolidColorBrush[]
                                 {   Brushes.Green, Brushes.BurlyWood,Brushes.CadetBlue,
                                     Brushes.Gray,Brushes.Chartreuse,Brushes.Chocolate,
                                     Brushes.AliceBlue,Brushes.Coral,Brushes.CornflowerBlue,
                                     Brushes.AntiqueWhite,Brushes.Cornsilk,Brushes.Crimson,
                                     Brushes.Aqua,Brushes.Cyan,Brushes.DarkBlue,Brushes.DarkCyan,
                                     Brushes.Aquamarine,Brushes.DarkGoldenrod,Brushes.DarkGray,
                                     Brushes.Azure,Brushes.DarkGreen,Brushes.DarkKhaki,
                                     Brushes.Beige,Brushes.DarkMagenta,Brushes.DarkOliveGreen,
                                     Brushes.Bisque,Brushes.DarkOrange,Brushes.DarkOrchid,
                                     Brushes.Black,Brushes.DarkRed,Brushes.DarkSalmon,
                                     Brushes.BlanchedAlmond,Brushes.DarkSeaGreen,Brushes.DarkSlateBlue,
                                     Brushes.Blue,Brushes.DarkSlateGray,Brushes.DarkTurquoise,
                                     Brushes.BlueViolet,Brushes.Brown,Brushes.DarkViolet
                                 };
     TextBox b = new TextBox() { Text = "Label " + contC };
     b.Name = "s" + contador;
     b.Background = brushes[new Random().Next(brushes.Length)];
     b.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
     b.VerticalAlignment = System.Windows.VerticalAlignment.Top;
     b.PreviewMouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.TextBox_PreviewMouseLeftButtonDown);
     b.PreviewMouseDown += new System.Windows.Input.MouseButtonEventHandler(this.TextBox_PreviewDown);
     this.workSpace.Children.Add(b);
     b.Margin = new Thickness(0, 0, 0, 0);
     contC++;
 }
開發者ID:RobertCalbul,項目名稱:Hilos,代碼行數:28,代碼來源:MainWindow.xaml.cs

示例15: GetBrush

        internal static Brush GetBrush(this ResourceDictionary dictionary, string brushName, string colorName, Brush defaultBrush)
        {
            if (dictionary == null)
            {
                return defaultBrush;
            }

            var obj = dictionary[brushName];
            if (obj is Brush)
            {
                return (Brush)obj;
            }

            obj = dictionary[colorName];
            if (obj is Color?)
            {
                var color = (Color?)obj;
                if (color.HasValue)
                {
                    var brush = new SolidColorBrush(color.Value);
                    brush.Freeze();
                    return brush;
                }
            }

            return defaultBrush;
        }
開發者ID:bordev,項目名稱:EasyMotion,代碼行數:27,代碼來源:Extensions.cs


注:本文中的System.Windows.Media.SolidColorBrush類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。