Questions tagged [system.windows.media]
44 questions
33
votes
2 answers
Convert System.Drawing.Color to System.Windows.Media.Color
System.Drawing.Color drawRedColor = System.Drawing.Color.Red;
System.Windows.Media.Color mediaColor = ?drawRedColor.ToMediaColor();?

serhio
- 28,010
- 62
- 221
- 374
15
votes
1 answer
System.Windows.Media.DrawingVisual.RenderOpen() erroring after a time
Use Case: I'm using WPF to dynamically overlay text on images within a web context.
Solution:
I'm using a DrawingContext from a DrawingVisual (wrapped in a using statement) to draw the original bitmap and overlay text.
Problem: After a few…

Daniel Bradley
- 1,120
- 1
- 12
- 22
13
votes
5 answers
How to make specific color darken or lighten based on value in wpf?
I am developing wpf application. I am having the instance of Color object in C#. Suppose I have instance of red Color object i.e. Color c = Color.FromArgb(255,255,0,0) Now suppose that I have one value which ranges from 1 to 10. So based on this…

Shailesh Jaiswal
- 3,606
- 13
- 73
- 124
5
votes
2 answers
Getting Geometry length
Does anyone know an efficient way of getting the length of a WPF geometry in Pixels?
I know that geometries in WPF are vector based and therefore do not really have a pixellength. But it has to be possible to get the length based on the visible…

Michael
- 145
- 1
- 8
4
votes
1 answer
System.Windows.Media.Imaging.WriteableBitmap leaking memory?
Consider the following code throws an exception 'MILERR_WIN32ERROR':
while(true)
{
System.Windows.Media.Imaging.WriteableBitmap writableBitMap =
new…

meds
- 21,699
- 37
- 163
- 314
3
votes
1 answer
Changing color of the GeometryDrawing Brush when Button is pressed
I created a Button Template. There are an Image and a Label.
The Source of the Image is in a ResourceDictionary Pictures. The Source of the picture is a DrawingImage with White brush color.
…

Pavel Etrich
- 69
- 2
- 9
3
votes
1 answer
Default foreground color of ProgressBar
I've been changing the foreground color of the ProgressBar control from my C# code using the Brush and Brushes classes from the System.Windows.Media library. However, I'm wondering if .Net provides access to the original default foreground color of…

Eric after dark
- 1,768
- 4
- 31
- 79
3
votes
2 answers
custom drawing portion of image .net 4.5
I am custom drawing two zoom-in images on the screen, one next to each other. Each one of them occupies half of the screen.
I have previously done it in .net 3.5 (I think) by overriding the OnPaint():
//using System.Drawing
///
…

jimasun
- 604
- 9
- 12
2
votes
1 answer
JPEGEncoder Windows Media Imaging not honoring color profile of Image
I have the following image (have put a screen-grab of the image as its size is more than 2 MB - the original can be downloaded from https://drive.google.com/file/d/1rC2QQBzMhZ8AG5Lp5PyrpkOxwlyP9QaE/view?usp=sharing
I'm reading the image using the…

techno
- 6,100
- 16
- 86
- 192
2
votes
1 answer
Can i add elements programatically to XAML? WPF c#
I want to add canvas elements by user input. Something like when a button is clicked, a new element is added to the XAML file, inside the Canvas.
2
votes
0 answers
TransformedBitmap in WPF is producing black lines under Windows XP
When porting a WPF application from windows 7 to windows XP, I found that where I was displaying a TransformedBitmap, thin, patterned black lines appear vertically down the image on transforms that aren't power of 2 resizes (1/2, 2, 4).
This is the…

Dan Monego
- 9,637
- 6
- 37
- 72
2
votes
0 answers
Can I override a color on an DrawingBrush image loaded from a resource?
I want to change the color on my Images created from my resource file without creating more resources.
My current solution is to create a second image resource with the color i want. But i want to set it in my code.
I load the image like this:
…

ace
- 21
- 3
2
votes
2 answers
How to convert string to Color in SharePoint Client Object model for silverlight?
I need to convert a string which has the name of a color (e.g. "Red") to an object of System.Windows.Media.Color.
I am using the following code:
using System.ComponentModel;
TypeConverter tc = new TypeConverter();
Color bgColor =…

Nidhi
- 33
- 1
- 5
1
vote
1 answer
UWP Media.Capture as a source for WebRTC
I would like to capture a media using this Windows.Media.Capture as a Stream for WebRTC. The reason for that is, that I would like to use the AddVideoEffectAsync() method to apply my custom Effect. Is that possible? And if not, what are the option…

MartinVotruba
- 343
- 2
- 17
1
vote
1 answer
HitTest and RayMeshGeometry3DHitTestResult programmatically in a window-less console application
I need to perform the intersection of a line and a triangle mesh.
That operation would be very conveniently performed if I could use VistualTreeHelper.HitTest method, that would return a RayMeshGeometry3DHitTestResult structure.
The problem is:…

heltonbiker
- 26,657
- 28
- 137
- 252