Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

IncGUI_BitPic - MetaTrader 5 Library | MT5 EA Download - MetaTrader 5 Resources

author EAcpu | 3 reads | 0 comments |

IncGUI_BitPic - library for MetaTrader 5

IncGUI_BitPic.mqh contains the CBitPic graphics control class file for pixel drawing (Figure 1).

IncGUI_BitPic - library for MetaTrader 5

Figure 1. Sample drawing using the CBitPic class.

You can draw points of different sizes - DrawDot(), lines on coordinates - DrawLine(), angle lines - DrawLineByAngle(), arrows - DrawArrow(), various shapes: rectangles - DrawRectangle(), triangles - DrawTriangle(), circles, ovals, rings, sectors - DrawCircle(). Ellipses can be rotated by a given angle (as well as elliptical rings and sectors). Shapes can only be filled or outlined. Text can be entered - TypeText() (multiple font and size options). The created image can be saved to a bmp file - SavePicture(), and loaded from a bmp file - LoadPicture() (the file should not be compressed, 24 or 32 bit).

Before you start using the control, include the IncGUI_BitPic.mqh file:

 #include

Then declare a class, for example 'p':

 CBitPic p;

This class was created using the principles stated in the article:

So it is used in a similar way to the control introduced in the article above: the Init() initialization method is called first; the Show() method is used to enable visibility; the Hide() method is used to hide and delete after the work is completed, etc.

In contrast, in the bone morphogenetic protein class, mapping is performed slightly differently. In cIntBMP, the drawing color is specified in the function that draws the shape. The process here is as follows: specify the background color - SetBGColor(), then clear it - Clear(). Before drawing, you need to set the width of the drawing - SetDrawWidth(), the color of the drawing - SetDrawColor() and the fill color - SetFillColor(), and you need to specify whether the shape is filled - SetFilled() or just outline. Next is to call the drawing function. The plot color, fill color, etc. can of course be changed if necessary. After drawing is complete, the Redraw() method should be called.

The following table lists all class methods:


The eBitPicTest.mq5 file provides examples of using the CBitPic class. Expert Advisor draws an image on the chart, as shown in Figure 1, and saves it to the CBitPic.bmp file (it should appear in the MQL5/Files terminal data folder). If you click on the image, the coordinates of the point and its color are displayed in the chart annotation, and a "snowflake" appears at the clicked point (top right corner of Figure 1).


Attachment download

📎 ebitpictest.mq5 (16.72 KB)

📎 incgui_bitpic.mqh (154.25 KB)

Source: MQL5 #1050

Verification code Refresh