I’m creating a picture in a listbox’s DragRow event. This is then applied as the DragPicture:
p = new Picture (500, 65)
g = p.Graphics
g.Transparency = 0.0
// text & other drawing here
drag.DragPicture = p
The picture thus created has some transparency (i.e., it is translucent) which I’d like to remove (it’s distracting). Further, under WIndows, the drag-picture is so translucent as to be almost invisible - much worse.
You may need to change the pixel colors to have less transparency.
or try:
// yourOriginalPicture
// p must be same size as original picture for best results.
p = new Picture (500, 65)
g = p.Graphics
g.Transparency = 0.0 // 0.0 is opaque
g.drawPicture(yourOriginalPicture, 0, 0) // redraws picture but this time the Transparency will be applied.
// p is now with re-applied transparency. May or may not have the effect you need.
I’ll give that a whirl, @Tim_Hare , but not til tomorrow as it’s now bedtime. But according to the docs, the third arg to the constructor is a set of bitmaps, not a depth. Not that I’ve been able to find out from the docs what a bimap is anyway. Depth is mentioned but only vaguely.
On Windows this transparency (plus gradient) is so bad that the drag picture is almost invisible. I’ll be able to see how bad it is under WIn-11 next week.
TMy drag-picture looks similar to the bottom-right portion of your image (and that’s the most visible part of my drag-picture. The least visible part is gone altogether).
Hmmm. More and more curious. I remembered that I now have four different drag/drop situations implemented in my app, and it belatedly occurred to me to check how the three that have been implemented for some time perform under Windows. The odd thing is that those three have no transparency issue under Windows. They all create a new picture, draw into it using various graphics methods, then assign it to the drag as its DragPicture. Only the fourth one, which does the same sorts of actions, has a problem. So far, looking through the code for all four, can’t see any significant difference in the actions taken.
OK, pinned it down. It struck me that the failing picture is rather larger than the working ones, at 500x65 instead of around 200x25. Reducing to those dimensions gave me under Windows a picture looking just like the ones under macOS or Linux.
Further testing allowed me to get to 300x65. Going to 301x65 - back to transparency and a gradient across the drag picture. Here are some screenshots:
I’ve read that this is controlled by the Windows OS and it’s afaik undocumented behaviour. But it can be changed for Win32 Apps using the IDragSourceHelper Interface.
I’ve talked to ChatGPT regarding this effect and tried to find documentations for it, but even ChatGPT wrote:
Unfortunately, there doesn’t seem to be official documentation from Microsoft explaining this limitation in detail. However, many developers have observed this behavior and discussed it in forums, suggesting it’s an intentional design to maintain system stability.
If you’re working with drag-and-drop in your application, keeping drag images within the 300x300 pixel limit is the safest approach to avoid transparency issues.