Support Board
Date/Time: Wed, 05 Feb 2025 20:07:20 +0000
Post From: Coloring Indicator area C++ option
[2025-01-07 11:46:01] |
MTScalper - Posts: 14 |
Hi. I'm try to create an indicator where I need to color areas above certain levels of the indicator, as shown in the picture. Currently, I'm using the Brush functionality, but it makes the indicator heavier because it continuously draws lines to cover the entire area. I was wondering if there are other compatible Windows or C++ libraries to improve this aspect and also have the possibility to set transparency levels with fading within these colored areas. I'm not sure if I explained myself clearly; I hope I was thorough enough. Code example // Drw the areas if (!OverboughtPoints.empty()) { // Alpha Brush (requires correction on transparency level) BYTE alpha = (BYTE)(255 * (100 - OverboughtTransparency) / 100); COLORREF color = RGB( (GetRValue(OverboughtColor) * alpha) / 255, (GetGValue(OverboughtColor) * alpha) / 255, (GetBValue(OverboughtColor) * alpha) / 255 ); HBRUSH hBrush = CreateSolidBrush(color); HBRUSH hOldBrush = (HBRUSH)SelectObject(DeviceContext, hBrush); // Drw the polygon on areas (need to improve) Polygon(DeviceContext, OverboughtPoints.data(), static_cast<int>(OverboughtPoints.size())); // Clean (need some correction) SelectObject(DeviceContext, hOldBrush); DeleteObject(hBrush); } Date Time Of Last Edit: 2025-01-08 14:01:34
|