Questions tagged [brush]

406 questions
43
votes
10 answers

Convert string to Brushes/Brush color name in C#

I have a configuration file where a developer can specify a text color by passing in a string: Rather than have a gigantic switch statement look for all of the possible colors, it'd be nice to just use the…
Clinton Pierce
  • 12,859
  • 15
  • 62
  • 90
24
votes
3 answers

Brush to Brush Animation

I managed to find out how to make a WPF animation - transition between two colors. It's called ColorAnimation and works well. ColorAnimation animation = new ColorAnimation { From = Colors.DarkGreen, To = Colors.Transparent, Duration =…
user1018711
22
votes
2 answers

Reference to another Brush from one Brush in xaml

Is it possible to directly reference to a Brush value from another Brush in my resource dictionary, without using a Color definition (or to be exact, copy one brush resource into another)? For example, I have a Brush definition:
mobileTofu
  • 1,071
  • 2
  • 14
  • 25
21
votes
4 answers

WPF - How can I make a brush that paints graph-paper-like squares?

How might I create a brush that paints a regular, repeated grid of 1-unit thick lines spaced evenly in both the horizontal and vertical axes? Imagine graph paper, if you will. Ideally the solution would allow control over the brushes used for the…
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
18
votes
2 answers

Update the y-axis of a brushed area chart

I am using d3.js, and I'm working on a brushed area chart by modifying this example. In addition to the x-axis changing based on the brush, I'd like chart's y-axis to be redrawn, based on the y-values of the data that fall within the brush (similar…
Sam Selikoff
  • 12,366
  • 13
  • 58
  • 104
18
votes
2 answers

Create stripe brush in WPF

How can I create a brush (DrawingBrush) for stripes as shown in the blog: http://blog.pixelingene.com/2008/09/quick-tip-to-get-a-striped-background/ I can't use it because it uses scale transform, which means if the UI element is small, the stripes…
Metro
  • 1,121
  • 1
  • 13
  • 33
16
votes
2 answers

c# radial gradient brush effect in GDI and winforms

I have created a c# windows application and written 75% of the code. The program allows the user to create a flow chart, and will shade the flow chart shapes according to their status. I wanted them to become 3d buttons such as from the website…
ClimberM
  • 319
  • 1
  • 4
  • 10
15
votes
4 answers

How do I implement a custom Brush in WPF?

Where can I find out enough info about how Brushes work to implement my own System.Windows.Media.Brush? I can handle all of the freezable baggage, but it's not really obvious what I need to override to get it to work. Yeah, so I didn't mean that I…
MojoFilter
  • 12,256
  • 14
  • 53
  • 61
13
votes
3 answers

Simpliest way to convert a Color as a string like #XXXXXX to System.Windows.Media.Brush

I think that the title is clear ! What I have now is : System.Drawing.Color uiui = System.Drawing.ColorTranslator.FromHtml(myString); var intColor = (uint)((uiui.A << 24) | (uiui.R << 16) | (uiui.G << 8) | (uiui.B << 0)); var bytes =…
Guillaume Slashy
  • 3,554
  • 8
  • 43
  • 68
13
votes
2 answers

brush on rotated lines using d3 to create zoom effect

I am working on this plnkr. I have three lines at angle 30, 45 and 60. I want to apply a brush on these lines so that when the chart is brushed the lines get redrawn at where it crossed the brushed rectangle with appropriate the values on the axis.…
somename
  • 978
  • 11
  • 30
12
votes
1 answer

System.Windows.Freezable is missing

I have got a Class Library project where I keep some interfaces and classes for my WPF Application and RIA Services. Into the one of class I want to add a member Brush BackgroundColor { set; get; } or SolidColorBrush BackgroundColor { set; get;…
NoWar
  • 36,338
  • 80
  • 323
  • 498
11
votes
3 answers

How to use LinearGradientBrush and Background

I'm trying to paint a background of my WPF window using LinearGradientBrush, however my code doesn't work. Here is the code LinearGradientBrush gradientBrush = new LinearGradientBrush( Color.FromArgb(0, 209, 227, 250), Color.FromArgb(0, 170, 199,…
wpflerner
  • 111
  • 1
  • 1
  • 3
11
votes
2 answers

d3.js brush fill color histogram

i have created some histogram with d3.js. I managed to change fill color of rect depending on the position of the brush. But i would like to change the color inside a rect. For example if the brush start is in the middle of the rect i would like…
Christophe D.
  • 1,089
  • 11
  • 21
11
votes
2 answers

WPF 'magic' negating brush?

I have a gradient that changes its colors, I want the text inside it should always be visible. I rather doing it dynamically if there is any out-the-box resource; I want a 'magic brush' that negates the color. Any experiments?
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
10
votes
3 answers

Repeat a background brush in WPF

and thank you. This question is very similar to this old, unanswered question here: How to paint notebook-like lines as TextBox background? However, it is not the same - not exactly. I would like to create a notepad, lined paper-like background but…
Jerry Nixon
  • 31,313
  • 14
  • 117
  • 233
1
2 3
27 28