The reason isn't the black vs white background — it's that a 24-bit BMP has no alpha channel at all, so there's nothing to make transparent. Two things usually fix this:
1. If you don't actually need an image file, skip the BMP and draw straight onto a canvas with an alpha-capable format. The default CreateBitmapLabel format is COLOR_FORMAT_XRGB_NOALPHA (opaque) — that's the usual culprit. Use ARGB_NORMALIZE and erase to a fully transparent background:
#include <Canvas\Canvas.mqh> CCanvas canvas; canvas.CreateBitmapLabel("myImg", x, y, w, h, COLOR_FORMAT_ARGB_NORMALIZE); canvas.Erase(0); // 0 = fully transparent canvas.FillCircle(w/2, h/2, 40, ColorToARGB(clrDodgerBlue, 255)); canvas.Update();
Erase(0) leaves the background see-through and only what you draw (with alpha in the color's A byte) shows up.
2. If you specifically need to load a picture, it has to be a 32-bit BMP with a real alpha channel — and save it in top-down row order. CCanvas has a long-standing quirk where a bottom-up BMP renders only the top half, which sends a lot of people down the wrong path.
ARGB_NORMALIZE premultiplies alpha for you, so blending over the chart looks correct out of the box. Start there.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello friends;
As I have tested before, we can just use images that are bmp type and also they should be 16 and 24 I think. I wanted to make an object that has no background. Let me explain with an example:
I used this article. The problem is when I want to create an image I don't know how to make transparent background. I used black bg and white bg, but none of them worked.
Do you know how I can fix it?