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

C# SolidColorBrush类代码示例

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

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



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

示例1: Player

 public Player(string name, Color color, float scale, string pos)
 {
     Name = name;
     Color = new SolidColorBrush(color);
     Scale = scale;
     Pos = pos;
 }
开发者ID:7711227,项目名称:Tutorials,代码行数:7,代码来源:DataModel3.cs


示例2: Initialize

partial         void Initialize()
        {
            Background = new SolidColorBrush(Colors.Transparent);
            Clip = new RectangleGeometry();

            SizeChanged += OnRenderSizeChanged;
        }
开发者ID:bhanu475,项目名称:XamlMapControl,代码行数:7,代码来源:MapBase.Silverlight.WinRT.cs


示例3: OnInitialize

        /// <summary>
        /// In a derived class, implements logic to initialize the sample.
        /// </summary>
        protected override void OnInitialize() {
            DeviceSettings2D settings = new DeviceSettings2D {
                Width = WindowWidth,
                Height = WindowHeight
            };

            InitializeDevice(settings);
            geometry = new PathGeometry(Context2D.RenderTarget.Factory);
            using (GeometrySink sink = geometry.Open()) {
                PointF p0 = new PointF(0.50f * WindowWidth, 0.25f * WindowHeight);
                PointF p1 = new PointF(0.75f * WindowWidth, 0.75f * WindowHeight);
                PointF p2 = new PointF(0.25f * WindowWidth, 0.75f * WindowHeight);

                sink.BeginFigure(p0, FigureBegin.Filled);
                sink.AddLine(p1);
                sink.AddLine(p2);
                sink.EndFigure(FigureEnd.Closed);

                // Note that Close() and Dispose() are not equivalent like they are for
                // some other IDisposable() objects.
                sink.Close();
            }

            brush = new SolidColorBrush(Context2D.RenderTarget, new Color4(0.93f, 0.40f, 0.08f));
        }
开发者ID:zhandb,项目名称:slimdx,代码行数:28,代码来源:SimpleTriangle2D.cs


示例4: CustomTextRenderer

 public CustomTextRenderer(Direct2DFactory factory, WindowRenderTarget renderTarget, SolidColorBrush outlineBrush, BitmapBrush fillBrush)
 {
     _factory = factory;
     _renderTarget = renderTarget;
     _outlineBrush = outlineBrush;
     _fillBrush = fillBrush;
 }
开发者ID:eugeniomiro,项目名称:Terrarium,代码行数:7,代码来源:CustomTextRenderer.cs


示例5: ColorChanging

        protected internal void ColorChanging(Color color)
        {
            Color = color;
            SolidColorBrush = new SolidColorBrush(Color);

            if (ColorChanged != null)
                ColorChanged(this, Color);
        }
开发者ID:selaromdotnet,项目名称:Coding4FunToolkit,代码行数:8,代码来源:ColorBaseControl.cs


示例6: TestSerialization

        public void TestSerialization()
        {
            var solidColorBrush = new SolidColorBrush { Color = Colors.Aqua };

            var writer = new StringWriter();
            _serializer.Serialize(writer, solidColorBrush);
            var reader = new StringReader(writer.ToString());

            Assert.AreEqual(solidColorBrush, _serializer.Deserialize(reader));
        }
开发者ID:pabloengine,项目名称:pablo,代码行数:10,代码来源:SolidColorBrushTest.cs


示例7: PDirect2DRenderer

        public PDirect2DRenderer(IntPtr winHandle)
        {
            fWindowHandle = winHandle;
            CreateFactories();
            CreateDeviceResources();

            Graphics = hwndRenderTarget;

            fStrokeBrush = Graphics.CreateSolidColorBrush(new ColorF(0, 0, 0, 1));
            fFillBrush = Graphics.CreateSolidColorBrush(new ColorF(1, 1, 1, 1));
        }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:11,代码来源:PDirect2DRenderer.cs


示例8: VpaidImageAdPlayer

        /// <summary>
        /// Creates a new instance of VpaidImageAdPlayer.
        /// </summary>
        /// <param name="skippableOffset">The position in the ad at which the ad can be skipped. If null, the ad cannot be skipped.</param>
        /// <param name="suggestedDuration">The duration of the ad. If not specified, the ad is closed when the next ad is played.</param>
        /// <param name="clickThru">The Uri to navigate to when the ad is clicked or tapped. Can be null of no action should take place.</param>
        public VpaidImageAdPlayer(FlexibleOffset skippableOffset, TimeSpan? suggestedDuration, Uri clickThru)
        {
            IsHitTestVisible = false;
            image = new Image();
            Background = new SolidColorBrush(Colors.Transparent);
            image.Stretch = Stretch.None;
            Opacity = 0;
            State = AdState.None;
            AdLinear = false;

            SkippableOffset = skippableOffset;
            SuggestedDuration = suggestedDuration;
            ClickThru = clickThru;
            this.NavigateUri = ClickThru;
        }
开发者ID:bondarenkod,项目名称:pf-arm-deploy-error,代码行数:21,代码来源:VpaidImageAdPlayer.cs


示例9: OnApplyTemplate

		public override void OnApplyTemplate()
		{
			WatermarkBrush = new SolidColorBrush(Colors.DarkGray);
#endif

			base.OnApplyTemplate();
			_textBox = (TextBox)GetTemplateChild("_textBox");
			_textBox.GotFocus += TextBoxOnGotFocus;
			_textBox.LostFocus += TextBoxOnLostFocus;
			_textBox.TextChanged += TextBoxOnTextChanged;

			originalForeground = _textBox.Foreground;

			UpdateText();
		}
开发者ID:yukiyuki,项目名称:MyToolkit,代码行数:15,代码来源:WatermarkedTextBox.cs


示例10: _render

        /**
         * Render with or without texture
         **/
        protected override void _render()
        {
            if (this._bitmap == null)
            {
                // Render in solid color
                if (_brush == null)
                    _brush = new SolidColorBrush(Device.RenderTarget, Color);

                Device.RenderTarget.FillRectangle(_brush, _rectangle);

                return;
            }

            if (this._d2dBitmap == null)
            {
                // Load the texture
                var bitmapData = this._bitmap.LockBits(
                    new Rectangle(new Point(0, 0), this._bitmap.Size),
                    System.Drawing.Imaging.ImageLockMode.ReadOnly,
                    System.Drawing.Imaging.PixelFormat.Format32bppPArgb
                );
                var dataStream = new SlimDX.DataStream(
                    bitmapData.Scan0,
                    bitmapData.Stride * bitmapData.Height,
                    true,
                    false
                );
                var d2dPixelFormat = new SlimDX.Direct2D.PixelFormat(
                    SlimDX.DXGI.Format.B8G8R8A8_UNorm,
                    SlimDX.Direct2D.AlphaMode.Premultiplied
                );
                var d2dBitmapProperties = new SlimDX.Direct2D.BitmapProperties();
                d2dBitmapProperties.PixelFormat = d2dPixelFormat;

                _d2dBitmap = new SlimDX.Direct2D.Bitmap(
                    Device.RenderTarget,
                    new Size(this._bitmap.Width, this._bitmap.Height),
                    dataStream,
                    bitmapData.Stride,
                    d2dBitmapProperties
                );
                this._bitmap.UnlockBits(bitmapData);
            }

            // Render the texture
            Device.RenderTarget.DrawBitmap(_d2dBitmap, _rectangle);
        }
开发者ID:sea-reel,项目名称:DirectX-2D-Mini-Engine,代码行数:50,代码来源:RectanglePrefab.cs


示例11: VpaidVideoAdPlayer

        /// <summary>
        /// Creates a new instance of VpaidVideoAdPlayer.
        /// </summary>
        /// <param name="skippableOffset">The position in the ad at which the ad can be skipped. If null, the ad cannot be skipped.</param>
        /// <param name="maxDuration">The max duration of the ad. If not specified, the length of the video is assumed.</param>
        /// <param name="clickThru">The Uri to navigate to when the ad is clicked or tapped. Can be null of no action should take place.</param>
        public VpaidVideoAdPlayer(FlexibleOffset skippableOffset, TimeSpan? maxDuration, Uri clickThru)
        {
            IsHitTestVisible = false;
            mediaElement = new MediaElement();
            Background = new SolidColorBrush(Colors.Black);
#if !WINDOWS80
            Opacity = 0.01; // HACK: Win8.1 won't load the video if opacity = 0
#else
            Opacity = 0;
#endif
            State = AdState.None;
            AdLinear = true;

            SkippableOffset = skippableOffset;
            MaxDuration = maxDuration;
            this.NavigateUri = clickThru;
        }
开发者ID:bondarenkod,项目名称:pf-arm-deploy-error,代码行数:23,代码来源:VpaidVideoAdPlayer.cs


示例12: CreateDeviceResources

        /// <summary>
        /// This method creates the render target and all associated D2D and DWrite resources
        /// </summary>
        void CreateDeviceResources()
        {
            // Only calls if resources have not been initialize before
            if (renderTarget == null)
            {
                // The text format
                textFormat = dwriteFactory.CreateTextFormat("Bodoni MT", 24, DWrite.FontWeight.Normal, DWrite.FontStyle.Italic, DWrite.FontStretch.Normal);

                // Create the render target
                SizeU size = new SizeU((uint)host.ActualWidth, (uint)host.ActualHeight);
                RenderTargetProperties props = new RenderTargetProperties();
                HwndRenderTargetProperties hwndProps = new HwndRenderTargetProperties(host.Handle, size, PresentOptions.None);
                renderTarget = d2dFactory.CreateHwndRenderTarget(props, hwndProps);

                // A black brush to be used for drawing text
                ColorF cf = new ColorF(0, 0, 0, 1);
                blackBrush = renderTarget.CreateSolidColorBrush(cf);

                // Create a linear gradient.
                GradientStop[] stops = 
                { 
                    new GradientStop(1, new ColorF(1f, 0f, 0f, 0.25f)),
                    new GradientStop(0, new ColorF(0f, 0f, 1f, 1f))
                };

                GradientStopCollection pGradientStops = renderTarget.CreateGradientStopCollection(stops, Gamma.Linear, ExtendMode.Wrap);
                LinearGradientBrushProperties gradBrushProps = new LinearGradientBrushProperties(new Point2F(50, 25), new Point2F(25, 50));

                linearGradientBrush = renderTarget.CreateLinearGradientBrush(gradBrushProps, pGradientStops);

                gridPatternBitmapBrush = CreateGridPatternBrush(renderTarget);

                solidBrush1 = renderTarget.CreateSolidColorBrush(new ColorF(0.3F, 0.5F, 0.65F, 0.25F));
                solidBrush2 = renderTarget.CreateSolidColorBrush(new ColorF(0.0F, 0.0F, 0.65F, 0.5F));
                solidBrush3 = renderTarget.CreateSolidColorBrush(new ColorF(0.9F, 0.5F, 0.3F, 0.75F));

                // Create a linear gradient.
                stops[0] = new GradientStop(1, new ColorF(0f, 0f, 0f, 0.25f));
                stops[1] = new GradientStop(0, new ColorF(1f, 1f, 0.2f, 1f));
                GradientStopCollection radiantGradientStops = renderTarget.CreateGradientStopCollection(stops, Gamma.Linear, ExtendMode.Wrap);

                RadialGradientBrushProperties radialBrushProps = new RadialGradientBrushProperties(new Point2F(25, 25), new Point2F(0, 0), 10, 10);
                radialGradientBrush = renderTarget.CreateRadialGradientBrush(radialBrushProps, radiantGradientStops);
            }
        }
开发者ID:QuocHuy7a10,项目名称:Arianrhod,代码行数:48,代码来源:Window1.xaml.cs


示例13: CreateImage

        /// <summary>
        /// Renders a UI control into an image.
        /// </summary>
        /// <param name="control"></param>
        /// <param name="isWideTile"></param>
        /// <returns></returns>
        public static void CreateImage(UIElement control, string imagePath, int width, int height, SolidColorBrush tileBackgroundColor)
        {
            // 1. Setup dimensions for wide tile.
            var bmp = new WriteableBitmap(width, height);

            // 2. Get the name of the background image based on theme            
            var canvas = new System.Windows.Controls.Canvas();
            canvas.Width = width;
            canvas.Height = height;
            canvas.Background = tileBackgroundColor;

            canvas.Children.Add(control);
            canvas.Measure(new Size(width, height));
            canvas.Arrange(new Rect(0, 0, width, height));
            canvas.UpdateLayout();

            // 4. Now output the control as text.
            bmp.Render(canvas, null);
            bmp.Invalidate();

            // 8. Now save the image to local folder.
            using (var store = IsolatedStorageFile.GetUserStoreForApplication())
            {
                // FileMode.Open, FileAccess.Read, FileShare.Read,
                using (var st = new IsolatedStorageFileStream(imagePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite, store))
                {
                    bmp.SaveJpeg(st, width, height, 0, 100);
                    st.Close();
                }
            }

            try
            {

                bmp = null;
                canvas.Children.Clear();
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
            catch (Exception ex)
            {
                Slate.Core.Logging.Logger.Error("Create image", "Warning, attempt to clear up memory for tile image failed", ex);
            }
        }
开发者ID:kishorereddy,项目名称:slate-lib,代码行数:50,代码来源:ImageHelper.cs


示例14: Pen

 /// <summary>
 /// Initializes a new instance of the <see cref="Pen"/> class.
 /// </summary>
 /// <param name="color">The stroke color.</param>
 /// <param name="thickness">The stroke thickness.</param>
 /// <param name="dashStyle">The dash style.</param>
 /// <param name="dashCap">The dash cap.</param>
 /// <param name="startLineCap">The start line cap.</param>
 /// <param name="endLineCap">The end line cap.</param>
 /// <param name="lineJoin">The line join.</param>
 /// <param name="miterLimit">The miter limit.</param>
 public Pen(
     uint color, 
     double thickness = 1.0,
     DashStyle dashStyle = null, 
     PenLineCap dashCap = PenLineCap.Flat, 
     PenLineCap startLineCap = PenLineCap.Flat,
     PenLineCap endLineCap = PenLineCap.Flat, 
     PenLineJoin lineJoin = PenLineJoin.Miter, 
     double miterLimit = 10.0)
 {
     Brush = new SolidColorBrush(color);
     Thickness = thickness;
     StartLineCap = startLineCap;
     EndLineCap = endLineCap;
     LineJoin = lineJoin;
     MiterLimit = miterLimit;
     DashStyle = dashStyle;
     DashCap = dashCap;
 }
开发者ID:Arlorean,项目名称:Perspex,代码行数:30,代码来源:Pen.cs


示例15: TextRenderTarget

        public TextRenderTarget(RenderTargetTexture renderTargetTexture)
        {
            var surface = renderTargetTexture.AsSurface();
            var factory2D = new SlimDX.Direct2D.Factory(SlimDX.Direct2D.FactoryType.SingleThreaded);

            var renderTargetProperties = new RenderTargetProperties
            {
                PixelFormat = new PixelFormat(Format.Unknown, AlphaMode.Premultiplied),
                Usage = RenderTargetUsage.None,
                HorizontalDpi = 96,
                VerticalDpi = 96,
                MinimumFeatureLevel = FeatureLevel.Direct3D10,
                Type = RenderTargetType.Default
            };

            mRenderTarget = RenderTarget.FromDXGI(factory2D, surface,
                renderTargetProperties);

            mBrush = new SolidColorBrush(mRenderTarget, new Color4(1, 1, 1));

            CreateTextFormat();
        }
开发者ID:Christof,项目名称:ionfish,代码行数:22,代码来源:TextRenderTarget.cs


示例16: InternalConvert

        public object InternalConvert(object value, Type targetType, object parameter)
        {
            if (value == null)
            {
                return null;
            }

            string colorName = value.ToString();
            SolidColorBrush scb = new SolidColorBrush();
            switch (colorName as string)
            {
                case "Magenta":
                    scb.Color = Colors.Magenta;
                    return scb;
                case "Purple":
                    scb.Color = Colors.Purple;
                    return scb;
                case "Brown":
                    scb.Color = Colors.Brown;
                    return scb;
                case "Orange":
                    scb.Color = Colors.Orange;
                    return scb;
                case "Blue":
                    scb.Color = Colors.Blue;
                    return scb;
                case "Red":
                    scb.Color = Colors.Red;
                    return scb;
                case "Yellow":
                    scb.Color = Colors.Yellow;
                    return scb;
                case "Green":
                    scb.Color = Colors.Green;
                    return scb;
                default:
                    return null;
            }
        }
开发者ID:dEMonaRE,项目名称:HearthstoneTracker,代码行数:39,代码来源:StringToBrushConverter.cs


示例17: MapGraticule

        public MapGraticule()
        {
            IsHitTestVisible = false;
            Stroke = new SolidColorBrush(Color.FromArgb(127, 0, 0, 0));

            path = new Path
            {
                Data = new PathGeometry()
            };

            path.SetBinding(Shape.StrokeProperty, new Binding
            {
                Source = this,
                Path = new PropertyPath("Stroke")
            });

            path.SetBinding(Shape.StrokeThicknessProperty, new Binding
            {
                Source = this,
                Path = new PropertyPath("StrokeThickness")
            });

            Children.Add(path);
        }
开发者ID:bhanu475,项目名称:XamlMapControl,代码行数:24,代码来源:MapGraticule.Silverlight.WinRT.cs


示例18: XamlCanvas

        public XamlCanvas()
        {
            Background = new SolidColorBrush (NativeColors.Transparent);

            MinFps = 4;
            MaxFps = 30;
            Continuous = true;

            _drawTimer = new DispatcherTimer();
            _drawTimer.Tick += DrawTick;

            Unloaded += HandleUnloaded;
            Loaded += HandleLoaded;
            LayoutUpdated += delegate { HandleLayoutUpdated (); };
        }
开发者ID:nissan,项目名称:CrossGraphics,代码行数:15,代码来源:XamlCanvas.cs


示例19: BrushForColor

        private static Brush BrushForColor(String colorName)
        {
            if (colorName == null) return null;

            if (brushCache == null)
            {
                brushCache = new Dictionary<string, Brush> {
                        { "black",     new SolidColorBrush(Colors.Black)     },
                        { "white",     new SolidColorBrush(Colors.White)     },
                        { "lightgray", new SolidColorBrush(Colors.LightGray) },
                        { "yellow",    new SolidColorBrush(Colors.Yellow)    },
                        { "none",      null                                  },
                    };
            }

            Brush ret = null;
            if (brushCache.TryGetValue(colorName, out ret))
            {
                return ret;
            }
            else
            {
                if (colorName.StartsWith("#"))
                {
                    string opacityPart = (colorName.Length == 7 ? "FF" : colorName.Substring(1, 2));
                    string colorPart = colorName.Substring((colorName.Length == 7 ? 1 : 3), 6);
                    byte a = (byte)Convert.ToInt32(opacityPart, 16);
                    byte r = (byte)Convert.ToInt32(colorPart.Substring(0, 2), 16);
                    byte g = (byte)Convert.ToInt32(colorPart.Substring(2, 2), 16);
                    byte b = (byte)Convert.ToInt32(colorPart.Substring(4, 2), 16);
                    Color c = Color.FromArgb(a, r, g, b);
                    var scb = new SolidColorBrush(c);
                    brushCache.Add(colorName, scb);
                    return scb;
                }
                throw new ArgumentOutOfRangeException("Color not supported: " + colorName);
            }
        }
开发者ID:jcookems,项目名称:freezing-ninja,代码行数:38,代码来源:XamlMapInfo.cs


示例20: OnCreateDeviceResources

        protected override void OnCreateDeviceResources(WindowRenderTarget renderTarget)
        {
            base.OnCreateDeviceResources(renderTarget);

            this._blackBrush = renderTarget.CreateSolidColorBrush(Color.FromARGB(Colors.Black, 1));
            this._customRenderer = new CustomTextRendererWithEffects(this.Direct2DFactory, renderTarget, this._blackBrush);
        }
开发者ID:eugeniomiro,项目名称:Terrarium,代码行数:7,代码来源:ClientDrawingEffectsControl.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# SolrBasicServer类代码示例发布时间:2022-05-24
下一篇:
C# SolidBrush类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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