R
roger.breton
Guest
I am drawn to WPF because of the ability to use 64-bit colors with the following code:
Dim Red, Green, Blue As Double
Red = 32768
Green = 32768
Blue = 32768
Dim myScRgbColor As New Color()
myScRgbColor = Color.FromScRgb(1, Red / 65536, Green/ 65536, Blue / 65536)
Dim myBrush As SolidColorBrush = New SolidColorBrush(myScRgbColor)
myRectangle.Fill = myBrush
canvas.Children.Insert(0, myRectangle)
This is brilliant! This is just what I need. However, since I'm completely "green" to the world of WPF, I naively expect to be able to change the Fill color dynamically. But I'm finding that's not how it works?
Whenever I try to 'change' the Fill 'brush', I get an exception error. I spend some time trying to understand where the "limitation" comes from but I confess, I'm going in circle right now....
Ultimately, I need to be able to change the Fill 'color' of this Rectangle inside a For...Next loop, where I increment the Red, Green and Blue values between 0,0,0 and 65536, in some meaningful increment. 24-bit RGB does not work for my application (I would have prefered to do this with WinForms).
Once I have the Rectangle 'filled' with the desired color THEN I take a measurement of the Rectangle color, as it shows up on my monitor, with a special instrument, and record the measurement into a file for later graphing and what not.
Any help is appreciated.
Continue reading...
Dim Red, Green, Blue As Double
Red = 32768
Green = 32768
Blue = 32768
Dim myScRgbColor As New Color()
myScRgbColor = Color.FromScRgb(1, Red / 65536, Green/ 65536, Blue / 65536)
Dim myBrush As SolidColorBrush = New SolidColorBrush(myScRgbColor)
myRectangle.Fill = myBrush
canvas.Children.Insert(0, myRectangle)
This is brilliant! This is just what I need. However, since I'm completely "green" to the world of WPF, I naively expect to be able to change the Fill color dynamically. But I'm finding that's not how it works?
Whenever I try to 'change' the Fill 'brush', I get an exception error. I spend some time trying to understand where the "limitation" comes from but I confess, I'm going in circle right now....
Ultimately, I need to be able to change the Fill 'color' of this Rectangle inside a For...Next loop, where I increment the Red, Green and Blue values between 0,0,0 and 65536, in some meaningful increment. 24-bit RGB does not work for my application (I would have prefered to do this with WinForms).
Once I have the Rectangle 'filled' with the desired color THEN I take a measurement of the Rectangle color, as it shows up on my monitor, with a special instrument, and record the measurement into a file for later graphing and what not.
Any help is appreciated.
Continue reading...