Questions tagged [drawingbrush]

36 questions
6
votes
1 answer

How do I convert from a Brush (e.g. DrawingBrush) to a BitmapSource?

I have a DrawingBrush with some vector graphics. I want to convert it to BitmapSource as an intermediate step to getting it to Bitmap. What's the (best) way to do this?
Tim Lovell-Smith
  • 13,077
  • 11
  • 67
  • 89
3
votes
1 answer

How to render DrawingBrush elements in ResourceDictionary in WPF?

I have a Xaml like the shown below. I have generated the Xaml from an emf file in expression. I need to enumerate and render the DrawingBrush elements. How can I accomplish that? Thanks!
2
votes
2 answers

WPF TileBrush and DrawingContext.DrawRectangle -- relative to upper-left of rectangle?

When using DrawingContext.DrawRectangle with a TileBrush, I noticed that the top-left of the rectangle is not the top-left of the underlying image. This occurs with both a DrawingBrush and an ImageBrush with the source as a DrawingImage. Is there a…
Robert Fraser
  • 9,967
  • 7
  • 59
  • 90
2
votes
1 answer

WPF pixel gridlines

I'm trying to draw a grid on my canvas in which: The lines are always one pixel thick The size of the square tile are expressed in pixel or in other words the distance between each horizontal and vertical lines is in pixels and maybe binded to the…
Bob Dull
  • 39
  • 4
2
votes
1 answer

How can I create DrawingBrush from an image (BMP/JPEG/PNG)?

I need to pass DrawingBrush to a method in a third-party DLL which displays an image somewhere in the application. I can't modify this. I need to create a DrawingBrush from an BMP Image. I tried this example but it doesn't work. Any help would be…
2
votes
1 answer

How to combine two different styles into one in xaml?

In my xaml page, I have one style and one drawingbrush which are given below -