I use these 2 methods to write GradientBrush and FillGeometry in OnRender
and the code I have in indicator:
OnRender()...
SharpDX.Direct2D1.Brush brush2 = null;
try
{
if (chartControl == null || RenderTarget==null || ChartBars==null || chartScale==null)
return;
Brush curBrush = Brushes.Blue;
float x= ...;
brush2 =BrushToGradient(RenderTarget, curBrush, 100, curBrush, 20, x, x, x, x);
fillGeometry(RenderTarget, brush2, vector1, new[] { vector2,vector3,vetor4 });
}
catch(Exception e)
{
Print(e.ToString());
}
finally
{
if (brush2 != null) brush2.Dispose();
}
Error on calling "OnRender"...
My Question: is that a problem that I call Methods for creation those things? What should I do to avoid the problem?

Comment