在 Windows 7 64 位系统上无法运行。
我想创建一个透明的。但没有成功。你可能会发现一个错误。或 cIntBMP Trasnparent Add 函数。

//+------------------------------------------------------------------+ //|测试。mq5 //| 2011 年 MetaQuotes 软件公司版权所有。 //|http://www.mql5.com || //+------------------------------------------------------------------+ #property copyright "Copyright 2011, MetaQuotes Software Corp." #property link "http://www.mql5.com" #property version "1.00" //+------------------------------------------------------------------+ //| 脚本程序启动功能| //+------------------------------------------------------------------+ #import "user32.dll" int GetDC(int hwnd); int ReleaseDC(int hwnd,int hdc); #import "gdi32.dll" int GetPixel(int hdc,int x,int y); int SetPixel(int hdc,int x,int y, int c); #import void OnStart() { int i, H, V, shH=0, shV=0, header; double hgh; color screen [80][80]; color r, g, b, cv=Red; //--- long hwnd=ChartGetInteger(ChartID(),CHART_WINDOW_HANDLE); int hdc=GetDC((int)hwnd); for(V=0; V<80; V++) { for(H=0; H<80; H++) { screen[V][H]=GetPixel(hdc,V,H); } } for(V=0; V<80; V++) { for(H=0; H<80; H++) { cv=screen[V][H]; cv=AlphaBlend(cv ,clrRed ); SetPixel(hdc, V+shV,H+shH,cv); } } Sleep(3000); } //+------------------------------------------------------------------+ /* α 混合例程 */ int AlphaBlend(int bg, int src) { int alpha = 100; return (src * alpha / 255 + bg * (255 - alpha) / 255); int a = src >> 24; /* 阿尔法 */ /* 如果源像素是透明的,则只返回背景 */ if (0 == a) return (bg); /* 对源色和背景色进行 alpha 混合 */ int rb = (((src & 0x00ff00ff) * a) + ((bg & 0x00ff00ff) * (0xff - a))) & 0xff00ff00; int g = (((src & 0x0000ff00) * a) + ((bg & 0x0000ff00) * (0xff - a))) & 0x00ff0000; return ( (src & 0xff000000) | ((rb | g) >> 8) ); }
有没有可能在不调用 dll 的情况下使用该库?
伙计们,也许还有其他方法能让画面更美观?
Dmitry Fedoseev 每次勾选时 更新整个图像。机器是铁,但还是让它处理更有用的任务吧。
你的意思是,在这些矩形和三角形对象上实现透明的唯一方法就是复制本文中的解决方案?学习 CCanvas 类。如何绘制透明对象 - MQL5 文章
Studying the CCanvas Class. How to Draw Transparent Objects
- www.mql5.com
Do you need more than awkward graphics of moving averages? Do you want to draw something more beautiful than a simple filled rectangle in your terminal? Attractive graphics can be drawn in the terminal. This can be implemented through the CСanvas class, which is used for creating custom graphics. With this class you can implement transparency, blend colors and produce the illusion of transparency by means of overlapping and blending colors.
cIntBMP - 一个用于创建BMP图像的库:
一个用于创建和输出BMP图像的类。
作者: Dmitry Fedoseev