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


C# SolidColorBrush.Freeze方法代码示例

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


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

示例1: MouseHandler

 static MouseHandler()
 {
     _brHighlight = new SolidColorBrush(Color.FromArgb(128, 255, 215, 140));
     _brHighlight.Freeze();
     _brInsert = new SolidColorBrush(Color.FromArgb(128, 0, 0, 0));
     _brInsert.Freeze();
 }
开发者ID:mdjabirov,项目名称:C1Decompiled,代码行数:7,代码来源:MouseHandler.cs

示例2: 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

示例3: ProvideValue

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

            brush.Freeze();
            return brush;
        }
开发者ID:spiked3,项目名称:ConeMapper,代码行数:7,代码来源:WpfExtensions.cs

示例4: TranslationAdornment

        /// <summary>
        /// Creates a square image and attaches an event handler to the layout changed event that
        /// adds the the square in the upper right-hand corner of the TextView via the adornment layer
        /// </summary>
        /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param>
        public TranslationAdornment(IWpfTextView view)
        {
            _view = view;

            Brush brush = new SolidColorBrush(Colors.BlueViolet);
            brush.Freeze();
            Brush penBrush = new SolidColorBrush(Colors.Red);
            penBrush.Freeze();
            Pen pen = new Pen(penBrush, 0.5);
            pen.Freeze();

            //draw a square with the created brush and pen
            System.Windows.Rect r = new System.Windows.Rect(0, 0, 30, 30);
            Geometry g = new RectangleGeometry(r);
            GeometryDrawing drawing = new GeometryDrawing(brush, pen, g);
            drawing.Freeze();

            DrawingImage drawingImage = new DrawingImage(drawing);
            drawingImage.Freeze();

            _image = new Image();
            _image.Source = drawingImage;

            //Grab a reference to the adornment layer that this adornment should be added to
            _adornmentLayer = view.GetAdornmentLayer("TranslationAdornment");

            _view.ViewportHeightChanged += delegate { this.onSizeChange(); };
            _view.ViewportWidthChanged += delegate { this.onSizeChange(); };
        }
开发者ID:JeanAzzopardi,项目名称:TranslatorExtensionPackage,代码行数:34,代码来源:TranslationAdornment.cs

示例5: Draw

		public void Draw(TextView textView, DrawingContext drawingContext)
		{
			if (textView == null)
				throw new ArgumentNullException("textView");
			if (drawingContext == null)
				throw new ArgumentNullException("drawingContext");
			
			if (currentResults == null || !textView.VisualLinesValid)
				return;
			
			var visualLines = textView.VisualLines;
			if (visualLines.Count == 0)
				return;
			
			int viewStart = visualLines.First().FirstDocumentLine.Offset;
			int viewEnd = visualLines.Last().LastDocumentLine.EndOffset;
			
			foreach (SearchResult result in currentResults.FindOverlappingSegments(viewStart, viewEnd - viewStart)) {
				BackgroundGeometryBuilder geoBuilder = new BackgroundGeometryBuilder();
				geoBuilder.AlignToWholePixels = true;
				geoBuilder.CornerRadius = 3;
				geoBuilder.AddSegment(textView, result);
				Geometry geometry = geoBuilder.CreateGeometry();
				if (geometry != null) {
					SolidColorBrush brush = new SolidColorBrush(Colors.LightGreen);
					brush.Freeze();
					drawingContext.DrawGeometry(brush, null, geometry);
				}
			}
		}
开发者ID:eusebiu,项目名称:SharpDevelop,代码行数:30,代码来源:SearchResultBackgroundRenderer.cs

示例6: PresentationSpace

 public PresentationSpace()
 {
     privacyOverlay = new SolidColorBrush { Color = Colors.Red, Opacity = 0.2 };
     privacyOverlay.Freeze();
     InitializeComponent();
     CommandBindings.Add(new CommandBinding(ApplicationCommands.Undo, (sender, args) => Commands.Undo.Execute(null)));
     CommandBindings.Add(new CommandBinding(ApplicationCommands.Redo, (sender, args) => Commands.Redo.Execute(null)));
     Commands.InitiateDig.RegisterCommand(new DelegateCommand<object>(InitiateDig));
     Commands.MoveTo.RegisterCommand(new DelegateCommand<Location>(MoveTo));
     Commands.ReceiveLiveWindow.RegisterCommand(new DelegateCommand<LiveWindowSetup>(ReceiveLiveWindow));
     Commands.MirrorPresentationSpace.RegisterCommand(new DelegateCommand<Window1>(MirrorPresentationSpace, CanMirrorPresentationSpace));
     Commands.PreParserAvailable.RegisterCommand(new DelegateCommand<MeTLLib.Providers.Connection.PreParser>(PreParserAvailable));
     Commands.UpdateConversationDetails.RegisterCommand(new DelegateCommand<ConversationDetails>(UpdateConversationDetails));
     Commands.ConvertPresentationSpaceToQuiz.RegisterCommand(new DelegateCommand<int>(ConvertPresentationSpaceToQuiz));
     Commands.SyncedMoveRequested.RegisterCommand(new DelegateCommand<int>(setUpSyncDisplay));
     Commands.InitiateGrabZoom.RegisterCommand(new DelegateCommand<object>(InitiateGrabZoom));
     Commands.Highlight.RegisterCommand(new DelegateCommand<HighlightParameters>(highlight));
     Commands.RemoveHighlight.RegisterCommand(new DelegateCommand<HighlightParameters>(removeHighlight));
     Commands.GenerateScreenshot.RegisterCommand(new DelegateCommand<ScreenshotDetails>(GenerateScreenshot));
     Commands.BanhammerSelectedItems.RegisterCommand(new DelegateCommand<object>(BanHammerSelectedItems));
     Commands.ShowConversationSearchBox.RegisterCommand(new DelegateCommand<object>(showConversationSearch));
     Commands.HideConversationSearchBox.RegisterCommand(new DelegateCommand<object>(hideConversationSearch));
     Commands.AllStaticCommandsAreRegistered();
     inConversation = true;
 }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:25,代码来源:PresentationSpace.xaml.cs

示例7: Convert

 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     var colourValue = (Color)value;
     var brush = new SolidColorBrush(colourValue);
     brush.Freeze();
     return brush;
 }
开发者ID:vserrago,项目名称:LiveDescribe-Desktop,代码行数:7,代码来源:ColorToSolidBrushConverter.cs

示例8: GetBrush

 public static Brush GetBrush(string heroKey)
 {
     var color = GetColor(heroKey);
     var brush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B));
     brush.Freeze();
     return brush;
 }
开发者ID:dEMonaRE,项目名称:HearthstoneTracker,代码行数:7,代码来源:HeroExtensions.cs

示例9: ClockWidget

        /// <summary>
        /// Provides a ClockWidget
        /// </summary>
        public ClockWidget()
        {
            DataContext = this;

            using (var service = ServiceFactory.GetCallbackServiceWrapper<ISettingsService>(new SettingsServiceCallback()))
            {
                object colorString = ColorConverter.ConvertFromString(service.Instance.GetSetting(SettingKeys.Color).GetValue<string>());
                if (colorString != null)
                {
                    _color = new SolidColorBrush((Color)colorString);
                }
                else
                {
                    _color = new SolidColorBrush(Colors.Red);
                }

                _waitTimeSetting = service.Instance.GetSetting(SettingKeys.WaitTime).GetValue<int>();
                _blink = service.Instance.GetSetting(SettingKeys.Blink).GetValue<bool>();
            }

            _black = new SolidColorBrush(Colors.Black);
            _transparent = new SolidColorBrush(Colors.Transparent);
            _black.Freeze();
            _color.Freeze();
            _transparent.Freeze();

            InitializeComponent();

            ForeColor = _black;
            _clockTimer = new DispatcherTimer();
            _clockTimer.Interval = TimeSpan.FromSeconds(0.5);
            _clockTimer.Tick += ClockTimer_Tick;
        }
开发者ID:happy5217744,项目名称:AlarmWorkflow,代码行数:36,代码来源:ClockWidget.xaml.cs

示例10: FrozenResources

        static FrozenResources()
        {
            PreviewIconPinnedBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0x97, 0x93, 0x8E));
            PreviewIconClickedBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0xA4, 0xA0, 0x9A));
            PreviewIconHoverBrush = new SolidColorBrush(Color.FromArgb(0x00, 0xFF, 0xFF, 0xFF));
            PreviewIconNormalBrush = new SolidColorBrush(Color.FromArgb(0x00, 0xFF, 0xFF, 0xFF));

            PreviewIconPinnedBrush.Freeze();
            PreviewIconClickedBrush.Freeze();
            PreviewIconHoverBrush.Freeze();
            PreviewIconNormalBrush.Freeze();

            #region Legacy Info Bubble related data members

            // TODO(Ben): Remove these once Info Bubble has been completely removed.
            WarningFrameFill = new SolidColorBrush(Color.FromRgb(0xff, 0xef, 0xa0));
            WarningFrameStrokeColor = new SolidColorBrush(Color.FromRgb(0xf2, 0xbd, 0x53));
            WarningTextForeground = new SolidColorBrush(Color.FromRgb(0x33, 0x33, 0x33));
            ErrorFrameFill = new SolidColorBrush(Color.FromRgb(255, 255, 255));
            ErrorFrameStrokeColor = new SolidColorBrush(Color.FromRgb(190, 70, 70));
            ErrorTextForeground = new SolidColorBrush(Color.FromRgb(190, 70, 70));

            WarningFrameFill.Freeze();
            WarningFrameStrokeColor.Freeze();
            WarningTextForeground.Freeze();
            ErrorFrameFill.Freeze();
            ErrorFrameStrokeColor.Freeze();
            ErrorTextForeground.Freeze();

            #endregion
        }
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:31,代码来源:FrozenResources.cs

示例11: DragDropManager

 internal DragDropManager(FrameworkElement owner)
 {
     _owner = owner;
     Visibility = Visibility.Collapsed;
     SetValue(RowSpanProperty, 1000);
     SetValue(ColumnSpanProperty, 1000);
     Background = Brushes.Transparent;
     _indicatorBorderBrush = new SolidColorBrush(Color.FromArgb(192, _clr.R, _clr.G, _clr.B));
     _indicatorBorderBrush.Freeze();
     _indicatorBackgroundBrush = new SolidColorBrush(Color.FromArgb(64, _clr.R, _clr.G, _clr.B));
     _indicatorBackgroundBrush.Freeze();
     _source = CreateIndicator();
     _target = CreateIndicator();
     MouseMove += delegate(object s, MouseEventArgs e)
     {
         base.Cursor = ((this._target.Width > 0.0) ? Cursors.Hand : null);
         this.OnDragging(e);
     };
     MouseLeftButtonUp += delegate(object s, MouseButtonEventArgs e)
     {
         this.IsOpen = false;
         this.OnDropped(e);
     };
     LostMouseCapture += delegate { this.IsOpen = false; };
 }
开发者ID:mdjabirov,项目名称:C1Decompiled,代码行数:25,代码来源:DragDropManager.cs

示例12: AchievementAdornments

        public AchievementAdornments(IWpfTextView view)
        {
            this.view = view;
            this.layer = view.GetAdornmentLayer("AchievementAdornments");
            this.descriptionLayer = view.GetAdornmentLayer("AchievementAdornmentsDescription");

            view.LayoutChanged += OnLayoutChanged;

            Brush brush = new SolidColorBrush(Color.FromArgb(0x20, 0x00, 0x00, 0xff));
            brush.Freeze();

            Brush penBrush = new SolidColorBrush(Colors.Red);
            penBrush.Freeze();

            Pen pen = new Pen(penBrush, 0.5);
            pen.Freeze();

            this.brush = brush;
            this.pen = pen;

            AchievementUIContext.AchievementClicked += (sender, e) =>
            {
                Reset();

                var filePath = GetFilePath(view);
                if (e.AchievementDescriptor.CodeOrigin.FileName != filePath)
                    return;

                codeOrigin = e.AchievementDescriptor.CodeOrigin;
                achievementUiElement = (UIElement)e.UIElement;

                CreateAdornment();
            };
        }
开发者ID:clausjoergensen,项目名称:strokes,代码行数:34,代码来源:AchievementAdornments.cs

示例13: Convert

        public static Brush Convert(System.Windows.Media.Color color)
        {
            var brush = new SolidColorBrush(color);
            brush.Freeze();

            return brush;
        }
开发者ID:squaredinfinity,项目名称:Foundation,代码行数:7,代码来源:ColorToSolidColorBrushConverter.cs

示例14: WpfArc

        public WpfArc(IArc arc)
        {
            _xarc = arc;

            _fillBrush = new SolidColorBrush(_xarc.Fill.ToNativeColor());
            _fillBrush.Freeze();
            _strokeBrush = new SolidColorBrush(_xarc.Stroke.ToNativeColor());
            _strokeBrush.Freeze();

            _path = new Path();
            _path.Tag = this;
            _path.Fill = _fillBrush;
            _path.Stroke = _strokeBrush;
            _path.StrokeThickness = arc.StrokeThickness;
            _pg = new PathGeometry();
            _pf = new PathFigure();
            _pf.IsFilled = arc.IsFilled;
            _pf.IsClosed = arc.IsClosed;
            _start = new Point();
            _as = new ArcSegment();
            SetArcSegment(_as, arc, out _start);
            _pf.StartPoint = _start;
            _pf.Segments.Add(_as);
            _pg.Figures.Add(_pf);
            _path.Data = _pg;

            Native = _path;
        }
开发者ID:monocraft,项目名称:RxCanvas,代码行数:28,代码来源:Wpf.cs

示例15: MapViewModel

 static MapViewModel()
 {
     red = new SolidColorBrush(Color.FromRgb(255, 32, 32));
     red.Freeze();
     green = new SolidColorBrush(Color.FromRgb(64, 200, 32));
     green.Freeze();
 }
开发者ID:i3c,项目名称:EventMapHpViewer,代码行数:7,代码来源:MapViewModel.cs


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