Hello all,
Using XPsp3.
I was playing with the idea to dynamically alter the contents of an ImageList, and found the https://learn.microsoft.com/en-us/windows/win32/api/commctrl/nf-commctrl-imagelist_getimageinfo
function, which says :
"The information in this structure can be used to *directly* manipulate the bitmaps for the image"
(bolding mine).
I've been trying to think of how that is possible - the bitmaps cannot be selected into a memoryDC - and to google information about how that would work, but came up empty.
Question:
Does anyone know what "directly manipulate the bitmaps" method MS is referring to in the above ?
Remark:
I already thought of and written another way to do what I want, but would like to know how the above works. Who knows, their (MS) method might be simpler. :-)
but the docs say GetImageInfo returns an ImageInfo structure, which
includes an hBitmap.
With that you can call things like GetDIBits, SetDIBits, etc.
Newyana2,
but the docs say GetImageInfo returns an ImageInfo structure, which
includes an hBitmap.
Indeed it does. Having the bitmap(s) is where my problems started. :-\
With that you can call things like GetDIBits, SetDIBits, etc.
Yep, I found the first one too (as well as GetBitmapBits). But I realized that it takes a *lot* of work to be able to create something generic from it (for instance, it would need handlers for all 6 BPP modi).
Also SetDIBits needs a BITMAPINFO structure filled in with stuff I /somehow/ would need to extract/copy from the origional bitmap.
The easier way (I think) would be to use CopyBitmap, load it into a
memoryDC* and use that to make the alterations on.
* which I would need to make sure it would have the same configuration
(Image List Creation Flags) as the one the ImageList was created with. In short: another problem.
... but that than has a "how do I get it back into the origional bitmap/imagelist ?" problem.
I was hoping that the MS way would show me a simple, smart way to circumvent all that clumsy work.
By the way:
for one test approach I invoked "the dark arts" and retrieved the
memoryDC(s) the ImageList uses internally. Drawing on them works as expected, very easy. Though there are a number of gotya's to recon with. As well as the use of "the dark arts" ofcourse. :-)
GDI gets very complicated. Gdiplus is worse.
Recently I've been working on functionality to change caret width
and color in a text window. The way to do it is to use a bitmap.
But in VB6 there's the Picturebox control. Lightweight...
and it wraps a lot of GDI ops.
Maybe you have something like that with Borland?
I sometimes use Image controls and sometimes use resources,
but never an imagelist.
That makes me remember something ..Oh yes, there it is. Maybe its useful to you :
https://devblogs.microsoft.com/oldnewthing/20240916-00/?p=110272
If you have ever used a List- or TreeView showing icons (including sorting-direction arrows and tickboxes) than you have used an ImageList.
Even Raymond Chen has opted for totally fucked up web design.
His page is pure white for me unless I disable CSS.
He must be tryint to force script.
If you have ever used a List- or TreeView showing icons (includingNope. I've never needed those and they seem like a pain.
sorting-direction arrows and tickboxes) than you have used an ImageList.
Newyana2,
GDI gets very complicated. Gdiplus is worse.
I've used both, but have not tried anything complicated with it.
Recently I've been working on functionality to change caret width
and color in a text window. The way to do it is to use a bitmap.
That makes me remember something ..Oh yes, there it is. Maybe its useful to you :
https://devblogs.microsoft.com/oldnewthing/20240916-00/?p=110272
But in VB6 there's the Picturebox control. Lightweight...
and it wraps a lot of GDI ops.
Maybe you have something like that with Borland?
:-) Thats the nice thing of using an Assembler : No programming-language provided wrappers around anything, you have to (understand and) write all of them yourself.
... which is also its downside.
But with me being me I normally have little problem with that. Even though that leads to problems as my current one.
I sometimes use Image controls and sometimes use resources,
but never an imagelist.
If you have ever used a List- or TreeView showing icons (including sorting-direction arrows and tickboxes) than you have used an ImageList.
Regards,
Rudy Wieser
No programming-language provided wrappers around anything,
you have to (understand and) write all of them yourself.
Unless you use libraries aznd function calls extensively.
John,
No programming-language provided wrappers around anything,
you have to (understand and) write all of them yourself.
Unless you use libraries aznd function calls extensively.
And thats indeed what I do. :-)
I *have* to, as, as mentioned, my programming language of choice, Assembly (Borlands Tasm32), doesn't offer such wrappers.
I bought the assembly bible once and started reading. I decided
life's too short for that.
The beauty of VB6 is that I can drag-drop GUI elements. No 3 pages of code
to create a button.
I can see the appeal of building a ship in a bottle. I'm just too
practical to do all that work only to have an object to sit on a
bookshelf.
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 17:13:20 |
| Calls: | 12,103 |
| Calls today: | 3 |
| Files: | 15,004 |
| Messages: | 6,518,068 |