I'm trying to re-use the chart color pallet in my, so I don't have to bother about whenever I use a white or a black chart the number will always be visible as I use the colors of the chart axis..
Getting the color brush I found the "ChartControl.Properties.ChartText"
Now I want to use this color in my "RenderTarget.DrawTextLayout()" and here I struggle...
// Snippet // Get the color of the Chart Text SharpDX.Direct2D1.Brush aapBrush = chartPanel.ChartControl.Properties.ChartText.ToDxBrush(RenderTarget); // Can't convert from Direct2D1 to SharpDX SharpDX.Direct2D1.SolidColorBrush customDXBrush = new SharpDX.Direct2D1.SolidColorBrush(RenderTarget, aapBrush); RenderTarget.DrawTextLayout(new SharpDX.Vector2((float)drawAtX, (float)(y - textFormat.FontSize / 2)), textLayout, customDXBrush, SharpDX.Direct2D1.DrawTextOptions.NoSnap);
Now I'm hitting the wall of the conversion of the brush.. how to approach this? Or is there a much simpler way to use the current chart pallet in the DrawTextLayout function?
UPDATE:
The brutal version that is working is forcing in a cast but I hope it can be more elegant than this.
SharpDX.Direct2D1.SolidColorBrush customDXBrush = (SharpDX.Direct2D1.SolidColorBrush)ChartControl.Properties.ChartText.ToDxBrush(RenderTarget);
Wes
Comment