Login Page - Create Account

Support Board


Date/Time: Thu, 02 May 2024 00:42:22 +0000



Post From: StudyRegionRightCoordinate Problem when

[2019-06-04 09:47:51]
BlakJak - Posts: 108
Hi User907968,

Doesn't your last statement contradict your first post?

BTW - the sc.StudyRegionLeftCoordinate does return the correct value for the left edge of the chart with respect to the client window that the chart+trade window are in. It is the sc.StudyRegionRightCoordinate that is incorrect when the trade window is attached on the left.

I have a suspicious feeling that sc.StudyRegionRightCoordinate is actually returning the width of the chart rather than the actual pixel coordinate of the right hand edge. This would mean the to get the right hand edge you need to add sc.StudyRegionLeftCoordinate and sc.StudyRegionRightCoordinate together.

I have tried this out in my code and I can confirm that this fixes the issue.

i.e. using this code fixes the problem when the Trade Window is on the left which in my view confirms a bug in the sc.StudyRegionRightCoordinate value.

// Set up the memory device context we will draw to so we can apply transparency. Copy the current image so there is no strange

// issue with the blending.

HDC hMemDC = CreateCompatibleDC(DeviceContext);
RECT rc;
//GetClientRect(WindowHandle, &rc);
rc.left = sc.StudyRegionLeftCoordinate;
rc.right = sc.StudyRegionLeftCoordinate + sc.StudyRegionRightCoordinate;
rc.top = sc.StudyRegionTopCoordinate;
rc.bottom = sc.StudyRegionBottomCoordinate;

HBITMAP hBitMap = CreateCompatibleBitmap(DeviceContext, rc.right - rc.left, rc.bottom - rc.top);
SelectObject(hMemDC, hBitMap);
BitBlt(hMemDC, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, DeviceContext, rc.left, rc.top, SRCCOPY);