2 different colors using Draw Text

Created at 21 Apr 2013, 21:06
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
lec0456's avatar

lec0456

Joined 14.11.2012

2 different colors using Draw Text
21 Apr 2013, 21:06


is there a way to use 2 or more colors for text displayed using static positioning? For exapmle, if i use:

 ChartObjects.DrawText("test","Hello"+"world", StaticPosition.TopCenter);


is there a way to display hello in red and world in blue?


@lec0456
Replies

Scott
21 Apr 2013, 22:33

RE:

I would also like to be able to do this for the fractional pip

     yPos = _simpleMovingAverage2.Result[index];
    text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
    ChartObjects.DrawText("obj2", text, xPos, yPos, VerticalAlignment.Bottom, HorizontalAlignment.Left,Colors.Yellow);

 


@Scott

cAlgo_Fanatic
22 Apr 2013, 10:48

You would have to split it into two objects. The second object should be padded with spaces to the left so that it does not overlap the first.

 

Also consider using "\t" - tabulation:

ChartObjects.DrawText("text1", "Hello", StaticPosition.TopLeft, Colors.Green);
ChartObjects.DrawText("text2", "\tWorld", StaticPosition.TopLeft, Colors.Yellow);

@cAlgo_Fanatic

lec0456
22 Apr 2013, 18:05

Awesome, works like a charm! Didn't realize you could do it that way.


@lec0456

lec0456
22 Apr 2013, 18:06

Oh, and the subscribe button seems to be working now! Thanks


@lec0456