How to draw inside OnMouseEvent  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
gbulle
Posts: 14
Joined: 18 Apr 2014
Has thanked: 2 times
Been thanked: 2 times

How to draw inside OnMouseEvent

Postby gbulle » 06 Apr 2015

Hello,

I am developing an indicator with CustomDrawing; I have MouseEvents(true) and I enter into this function when I click the mouse:

protected override void OnMouseEvent(MouseClickArgs arg)
{
//here after having clicked
}

inside OnMouseEvent(MouseClickArgs arg) I would like to draw a rectangle using a code like this:

Pen p1=new Pen(Color.Yellow,1);
PointF b1,b2;
b1 = GetPointFromBar(context, Bars.Time[0],Bars.Close[0]);
context.graphics.DrawRectangle(p1,b1.X,b1.Y,100,100);


How to retrieve context inside OnMouseEvent?

Tx

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: How to draw inside OnMouseEvent  [SOLVED]

Postby Henry MultiСharts » 09 Apr 2015

Hello gbulle,

You can save the coordinates and put a flag. Then while drawing if there is a flag then draw using the saved coordinates.


Return to “MultiCharts .NET”