Saturday, April 10, 2010
Problem with a chart with a polyline and a LinearGradientBrush
Programmer Question
I have a graph with a polyline contained into a canvas. I would like to set the stroke of the polyline starting from a color at the bottom and ending to another color on top. I tried with this xaml:
<Polyline StrokeThickness="2">
<Polyline.Stroke>
<LinearGradientBrush StartPoint="0.5,1" EndPoint="0.5,0">
<GradientStop Color="Blue" Offset="0" />
<GradientStop Color="Cyan" Offset="1" />
</LinearGradientBrush>
</Polyline.Stroke>
</Polyline>
In this way it works but the height of the gradient is equal to the height of the polyline. I mean, if I have a polyline which goes from the bottom of the canvas to its top, the gradient is applied over the entire height of the canvas. If I have instead a horizontal polyline, the gradient is applied to its thickness.
I would like to have a gradient height equal to the canvas height, independently from the polyline height.
How can I achieve this?
Find the answer here
How can two programs talk to each other in Java?
Programmer Question
I want to reduce the CPU usage/ROM usage/RAM usage - generally, all system resources that my app uses - who doesn't? :)
For this reason I want to split the preferences window from the rest of the application,
and let the preferences window to run as independent program.
The preferences program should write to a Property file(not a problem at all) and to send a "update signal" to the main program - which means it should call the update method (that i wrote) that found in the Main class.
How can I call the update method in the Main program from the preferences program?
To put it another way, is a way to build preferences window that take system resources just when the window appears?
Is this approach - of separating programs and let them talk to each other (somehow) - the right approach for speeding up my programs?
Find the answer here