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


C# Media.SolidColorBrush類代碼示例

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


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

示例1: SubredditSideBar

        public SubredditSideBar()
        {
            this.InitializeComponent();

            // Get the accent color
            Color accentColor = ((SolidColorBrush)App.Current.Resources["SystemControlBackgroundAccentBrush"]).Color;

            // Set the title color
            Color darkAccent = accentColor;
            darkAccent.A = 170;
            ui_titleHeaderContainer.Background = new SolidColorBrush(darkAccent);

            // Set the button container background
            Color darkerAccent = accentColor;
            darkerAccent.A = 90;
            ui_buttonContainer.Background = new SolidColorBrush(darkerAccent);

            // Set the active button background
            Color buttonActive = accentColor;
            buttonActive.A = 200;
            m_buttonActive = new SolidColorBrush(buttonActive);

            // Get the button inactive color
            Color buttonAccent = accentColor;
            buttonAccent.A = 90;
            m_buttonInactive = new SolidColorBrush(buttonAccent);

            // Set the submit link and text colors
            ui_submitPostButton.Background = m_buttonInactive;
            ui_searchSubreddit.Background = m_buttonInactive;
        }
開發者ID:Arthur-Lee,項目名稱:Baconit,代碼行數:31,代碼來源:SubredditSideBar.xaml.cs

示例2: PerformFaceAnalysis

        private async void PerformFaceAnalysis(StorageFile file)
        {
            var imageInfo = await FileHelper.GetImageInfoForRendering(file.Path);
            NewImageSizeWidth = 300;
            NewImageSizeHeight = NewImageSizeWidth*imageInfo.Item2/imageInfo.Item1;

            var newSourceFile = await FileHelper.CreateCopyOfSelectedImage(file);
            var uriSource = new Uri(newSourceFile.Path);
            SelectedFileBitmapImage = new BitmapImage(uriSource);


            // start face api detection
            var faceApi = new FaceApiHelper();
            DetectedFaces = await faceApi.StartFaceDetection(newSourceFile.Path, newSourceFile, imageInfo, "4c138b4d82b947beb2e2926c92d1e514");

            // draw rectangles 
            var color = Color.FromArgb(125, 255, 0, 0);
            var bg = new SolidColorBrush(color);

            DetectedFacesCanvas = new ObservableCollection<Canvas>();
            foreach (var detectedFace in DetectedFaces)
            {
                var margin = new Thickness(detectedFace.RectLeft, detectedFace.RectTop, 0, 0);
                var canvas = new Canvas()
                {
                    Background = bg,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment = VerticalAlignment.Top,
                    Height = detectedFace.RectHeight,
                    Width = detectedFace.RectWidth,
                    Margin = margin
                };
                DetectedFacesCanvas.Add(canvas);
            }
        }
開發者ID:modulexcite,項目名稱:ProjectOxford,代碼行數:35,代碼來源:MainPage.xaml.cs

示例3: DrawGrid

        private void DrawGrid()
        {
            int index = 0;

            SolidColorBrush black = new SolidColorBrush(Colors.Black);
            SolidColorBrush white = new SolidColorBrush(Colors.White);

            // Set colors of each rectangle based on grid values
            for (int r = 0; r < gridWidth; r++)
                for (int c = 0; c < gridWidth; c++)
                {
                    Rectangle rect = paintCanvas.Children[index] as Rectangle;
                    index++;

                    if (grid[r, c])
                    {
                        // On
                        rect.Fill = white;
                        rect.Stroke = black;
                    }
                    else
                    {
                        // Off
                        rect.Fill = black;
                        rect.Stroke = white;
                    }
                }
        }
開發者ID:jgreenlee24,項目名稱:LightsOut_WinStore,代碼行數:28,代碼來源:MainPage.xaml.cs

示例4: init

        void init()
        {
            Background = new SolidColorBrush(ColorHelper.FromArgb(70, 0, 0, 0));

            progressbar = new ProgressBar() { IsIndeterminate =true };
            Children.Add(progressbar);
        }
開發者ID:Milton761,項目名稱:mLearningCoreEN,代碼行數:7,代碼來源:HorizontalLoading.cs

示例5: Convert

        //public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        //{
        //    int CURRENT_DEGREE = System.Convert.ToInt32(value);
        //    RadialGradientBrush gb = parameter as RadialGradientBrush;
        //    switch (CURRENT_DEGREE)
        //    {
        //        case 0:
        //            //return gb;
        //            RadialGradientBrush rb = new RadialGradientBrush();
        //            //rb.GradientStops.Add(new GradientStop() { Color = Colors.Transparent, Offset = 0 });
        //            return rb;
        //        case 1:
        //            foreach (GradientStop s in gb.GradientStops)
        //            {
        //                Color c = Colors.Yellow;
        //                c.A = s.Color.A;
        //                s.Color = c;
        //            }
        //            return gb;
        //        case 2:
        //            foreach (GradientStop s in gb.GradientStops)
        //            {
        //                Color c = Colors.Orange;
        //                c.A = s.Color.A;
        //                s.Color = c;
        //            }
        //            return gb;
        //        case 3:
        //            foreach (GradientStop s in gb.GradientStops)
        //            {
        //                Color c = Colors.Red;
        //                c.A = s.Color.A;
        //                s.Color = c;
        //            }
        //            return gb;
        //        default:
        //            return new RadialGradientBrush();
        //    }
        //    throw new NotImplementedException();
        //}
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            int CURRENT_DEGREE = System.Convert.ToInt32(value);
             //   SolidColorBrush gb = parameter as SolidColorBrush;

            switch (CURRENT_DEGREE)
            {
                case 0:

                    //return gb;

                    SolidColorBrush rb = new SolidColorBrush(Colors.Transparent);
                    //rb.GradientStops.Add(new GradientStop() { Color = Colors.Transparent, Offset = 0 });
                    return rb;
                case 1:
                    return new SolidColorBrush(Colors.Yellow);
                case 2:
                    return new SolidColorBrush(Colors.Orange);
                case 3:
                    return new SolidColorBrush(Colors.Red);

                default:
                    return new SolidColorBrush(Colors.Transparent);
            }
        }
開發者ID:ufjl0683,項目名稱:sshmc,代碼行數:65,代碼來源:Converters.cs

示例6: ButtonGenerate_Click

        private void ButtonGenerate_Click(object sender, RoutedEventArgs e)
        {
            // Generate points for graph
            var points = new List<Point>();
            for (var connectivity = 0; connectivity <= 100; connectivity += 1)
            {
                var possibility = .0;
                for (var testNumber = 0; testNumber < TestsCount; testNumber++)
                    if (CheckBoxType.IsChecked != null && (!CheckBoxType.IsChecked.Value && _schedule.CheckConflict(Convert.ToInt16(SliderSize.Value), connectivity) ||
                                                           CheckBoxType.IsChecked.Value && _schedule.CheckNecessary(Convert.ToInt16(SliderSize.Value), connectivity)))
                        possibility++;
                possibility /= TestsCount;
                points.Add(new Point((int)(connectivity * CanvasGraph.RenderSize.Width * .01), (int)(CanvasGraph.RenderSize.Height - possibility * CanvasGraph.RenderSize.Height)));
            }

            // Draw graph
            var b = new SolidColorBrush(_colors[_colorIdx++ % _colors.Count]);
            for (var i = 0; i < points.Count - 1; i++)
            {
                var line = new Line
                {
                    Stroke = b,
                    X1 = points[i].X,
                    X2 = points[i + 1].X,
                    Y1 = points[i].Y,
                    Y2 = points[i + 1].Y,
                    StrokeThickness = 2
                };

                CanvasGraph.Children.Add(line);
            }
        }
開發者ID:MaxBondarchuk,項目名稱:T7_SSW_Lab4,代碼行數:32,代碼來源:MainPage.xaml.cs

示例7: Contact

        public Contact(SolidColorBrush foregroundColor, SolidColorBrush backgroundColor, bool imageMirrored = false)
        {
            this.InitializeComponent();

            SetColors(foregroundColor, backgroundColor);
            SetFooterImage(imageMirrored);
        }
開發者ID:Prog-Party,項目名稱:ProgParty.BoredPanda,代碼行數:7,代碼來源:Contact.xaml.cs

示例8: init

        void init()
        {
            Background = new SolidColorBrush(Colors.Transparent);
            HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;

            _transform = new CompositeTransform() { CenterX = DeviceWidth / 2, CenterY = DeviceHeight / 2 };
            RenderTransform = _transform;

            _backimage = new Image() { Stretch = Stretch.UniformToFill };
            Children.Add(_backimage);

            //just bytes
            //_blackgrid = new Grid() { Width = DeviceWidth, Height = DeviceHeight, Background = new SolidColorBrush(Colors.Black), Opacity = 0.4 };
            //Children.Add(_blackgrid);

            //just bytes
            //_backtext = new CoverTextSlide();
            //Children.Add(_backtext);

            _pagegrid = new Grid() { Width = DeviceWidth, Height = DeviceHeight };
            Children.Add(_pagegrid);
            Canvas.SetZIndex(_pagegrid, -10);

            //just bytes
            //_loadingview = new LoadingView() { Width = 1600, Height = 900 };
            //Children.Add(_loadingview);

        }
開發者ID:Milton761,項目名稱:mLearningCoreEN,代碼行數:28,代碼來源:LOReaderScrollElement.cs

示例9: AppSettings_PropertyChanged

 private void AppSettings_PropertyChanged( object sender, global::System.ComponentModel.PropertyChangedEventArgs e )
 {
     if( e.PropertyName == Parameters.APPEARANCE_CONTENTREADER_NAVBG )
     {
         BackgroundBrush = new SolidColorBrush( Properties.APPEARANCE_CONTENTREADER_NAVBG );
     }
 }
開發者ID:tgckpg,項目名稱:wenku10,代碼行數:7,代碼來源:NavPaneSection.cs

示例10: AuthorFlairKindConverter

 static AuthorFlairKindConverter()
 {
     if (Application.Current.Resources.ContainsKey("SystemColorControlAccentColor"))
         bg_op = Application.Current.Resources["SystemColorControlAccentColor"] as SolidColorBrush;
     else
         bg_op = Utility.GetColorFromHexa("#FFDAA520");
 }
開發者ID:hippiehunter,項目名稱:Baconography,代碼行數:7,代碼來源:AuthorFlairKindConverter.cs

示例11: Convert

        /// <summary>
        ///     Convert a hexadecimal color string to a corresponding brush
        /// </summary>
        /// <param name="value">Value to convert</param>
        /// <param name="targetType">Target type requiered</param>
        /// <param name="parameter">Converter parameter</param>
        /// <param name="language">language information</param>
        /// <returns>The corresponding brush</returns>
        public object Convert(object value,
                              Type targetType,
                              object parameter,
                              String language)
        {
            String color = ((String)value).Replace("#",
                                                    "");
            Brush colorBrush = null;

            if (color.Length == 6)
            {
                if (Brushes.ContainsKey(color))
                {
                    return Brushes[color];
                }

                colorBrush = new SolidColorBrush(Color.FromArgb(255,
                                                                byte.Parse(color.Substring(0,
                                                                                           2),
                                                                           NumberStyles.HexNumber),
                                                                byte.Parse(color.Substring(2,
                                                                                           2),
                                                                           NumberStyles.HexNumber),
                                                                byte.Parse(color.Substring(4,
                                                                                           2),
                                                                           NumberStyles.HexNumber)));

                Brushes[color] = colorBrush;
            }

            return colorBrush;
        }
開發者ID:dinord2005,項目名稱:MyUniversalConverters,代碼行數:40,代碼來源:HexStringToSolidColorBrushConverter.cs

示例12: Page_LayoutUpdated

 private void Page_LayoutUpdated(object sender, object e)
 {
     if (new RepositorioConfig().ObterTodos().Any())
     {
         var solidbrush = new SolidColorBrush(
                 Color.FromArgb(
                     Convert.ToByte(
                         new RepositorioConfig().ObterTodos()
                             .FirstOrDefault(c => c.Componente.Equals(StackPanelMenu.Name.ToString()))
                             .ColorA),
                     Convert.ToByte(
                         new RepositorioConfig().ObterTodos()
                             .FirstOrDefault(c => c.Componente.Equals(StackPanelMenu.Name.ToString()))
                             .ColorR),
                     Convert.ToByte(
                         new RepositorioConfig().ObterTodos()
                             .FirstOrDefault(c => c.Componente.Equals(StackPanelMenu.Name.ToString()))
                             .ColorG),
                     Convert.ToByte(
                         new RepositorioConfig().ObterTodos()
                             .FirstOrDefault(c => c.Componente.Equals(StackPanelMenu.Name.ToString()))
                             .ColorB)));
         StackPanelMenu.Background = solidbrush;
         HeaderPanel.Background = solidbrush;
         UpdateLayout();
     }
 }
開發者ID:carloshenriquecarniatto,項目名稱:Podcasts,代碼行數:27,代碼來源:MainPage.xaml.cs

示例13: MoviePlayer

        public MoviePlayer(ref Popup Popup)
        {
            this.popup = Popup;
            this.InitializeComponent();
            string youTubeId = "VXPoJAyeF8k";
            TestImage.Source = image;
            TestImage.Height = 500;
            TestImage.Width = 340;

            var url = YouTube.GetVideoUriAsync(youTubeId);
            var url2 = YouTube.GetVideoUri(youTubeId, YouTubeQuality.Quality1080P, null);
            MovieContainer.Source = url.Result.Uri;
            MovieContainer.Play();
            MovieContainer.Width = baseMovieWidth;
            MovieContainer.Height = baseMovieHeight;

            LikeActive = new SolidColorBrush();
            LikeActive.Color = Colors.ForestGreen;

            LikeInactive = new SolidColorBrush();
            LikeInactive.Color = Colors.White;

            DislikeActive = new SolidColorBrush();
            DislikeActive.Color = Colors.Red;

            DislikeInactive = new SolidColorBrush();
            DislikeInactive.Color = Colors.White;
        }
開發者ID:alexsb92,項目名稱:TheMovieTrailerApp,代碼行數:28,代碼來源:MoviePlayer.xaml.cs

示例14: Convert

 public object Convert(object value, Type targetType, object parameter, string language)
 {
     var state = value.ToString();
     SolidColorBrush returnValue = null;
     if (state != null)
     {
         switch (state)
         {
             case "Nothing":
                 returnValue = new SolidColorBrush(Functions.FromStringColor("#00FFFFFF"));
                 break;
             case "ChoiceNobodyNormal":
                 returnValue = new SolidColorBrush(Functions.FromStringColor("#FF7392CB"));
                 break;
             case "ChoiceNobodyCouple":
                 returnValue = new SolidColorBrush(Functions.FromStringColor("#FFF77979"));
                 break;
             case "ChoiceNobodyOldWeak":
                 returnValue = new SolidColorBrush(Functions.FromStringColor("#FFB8DD8C"));
                 break;
             case "ChoiceMe":
                 returnValue = new SolidColorBrush(Functions.FromStringColor("#FFF9B196"));
                 break;
             case "ChoiceOther":
                 returnValue = new SolidColorBrush(Functions.FromStringColor("#FFD1D1D1"));
                 break;
         }
     }
     return returnValue;
 }
開發者ID:vapps,項目名稱:RMovie,代碼行數:30,代碼來源:SeatStateToColorConverter.cs

示例15: MapControl

        public MapControl()
        {
            Background = new SolidColorBrush(Colors.White); // DON'T REMOVE! Touch events do not work without a background

            Children.Add(_renderTarget);
            Children.Add(_bboxRect);
            Children.Add(_attributionPanel);

            _renderTarget.PaintSurface += _renderTarget_PaintSurface;
                        
            Map = new Map();
            Loaded += MapControlLoaded;

            SizeChanged += MapControlSizeChanged;
            CompositionTarget.Rendering += CompositionTarget_Rendering;
            _renderer = new MapRenderer();
            PointerWheelChanged += MapControl_PointerWheelChanged;

            ManipulationMode = ManipulationModes.Scale | ManipulationModes.TranslateX | ManipulationModes.TranslateY;
            ManipulationDelta += OnManipulationDelta;
            ManipulationCompleted += OnManipulationCompleted;
            ManipulationInertiaStarting += OnManipulationInertiaStarting;

            var orientationSensor = SimpleOrientationSensor.GetDefault();
            if (orientationSensor != null)
                orientationSensor.OrientationChanged += (sender, args) =>
                    Task.Run(() => Dispatcher.RunAsync(CoreDispatcherPriority.Normal, Refresh))
                        .ConfigureAwait(false);
        }
開發者ID:pauldendulk,項目名稱:Mapsui,代碼行數:29,代碼來源:MapControl.cs


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