Login Page - Create Account

Support Board


Date/Time: Thu, 02 May 2024 08:24:52 +0000



Post From: StudyRegionRightCoordinate Problem when

[2019-05-01 17:22:30]
BlakJak - Posts: 108
I am using GDI and need to get the coordinates of my screen to setup the compatible bitmap for drawing.

I use these lines to get the coorindates:

RECT rc;
rc.left = sc.StudyRegionLeftCoordinate;
rc.right = sc.StudyRegionRightCoordinate;
rc.top = sc.StudyRegionTopCoordinate;
rc.bottom = sc.StudyRegionBottomCoordinate;

Then I use the following for drawing where itr->barIndex() is the index of the bar at which I am going to draw an object.

int x = sc.BarIndexToXPixelCoordinate(itr->barIndex());



The resulting "x" is correct and draws the objects in the correct place on the chart, however it seems that my compatible bitmap is not correct when I attach the trade window to the left side of my chart. My drawings disappear near to the right hand side of my chart at exactly the width of the Trade Window. This means that when I create a compatible bitmap using the StudyRegion coordinates it is not giving me the correct screen coordinates to make my bitmap.

If I remove the Trade Window then the study draws perfectly all the way to the right hand side of the chart.

Could this be a bug in the way the sc.StudyRegionRightCoordinate returns the value when the Trade Window is attached on the left? Or do I need to convert the Study Region coordinates to pixel coordinates somehow? If the later, can you explain to me how to do it?