Have you tried just to send %NULL?
and then redraw?Control Send hwnd, %ID_LISTVIEW3, %STM_SETIMAGE, %IMAGE_BITMAP, %NULL
How can I clear a label control of a picture put there by GDIp commands?
How can I erase/delete the graphic from the label instantly?If FILE_Exists( szfile ) Then '---Create an image handle hGpBitmap = GDIp_CreateBitMapFromFile( szfile ) '---Convert to a BMP handle hBitmap3 = GDIp_CreateHBitMapFromBitmap(hGpBitmap, 0) GDIp_DisposeImage(hGpBitmap) '---Show picture in Label control Control Send hwnd, %ID_LISTVIEW3, %STM_SETIMAGE, %IMAGE_BITMAP, hBitmap3 '---Following commands ensure picture appears correctly and is sized correctly in control SendMessage hwnd, %WM_SIZE, 0,1 Control Redraw hwnd, %id_listview3 Exit Function End If
I tried:
Object_Delete (hBitmap3)
Didn't seem to work as I had thought and there is a
GDIp_DeleteGraphics
command but not sure how to use....
Any help appreciated.
Regards,
catventure.
http://tab.thinbasic.com - Home Of The ThinBasic Adventure Builder Project. (Interactive Fiction/Text Adventure Maker)
Have you tried just to send %NULL?
and then redraw?Control Send hwnd, %ID_LISTVIEW3, %STM_SETIMAGE, %IMAGE_BITMAP, %NULL
Last edited by ErosOlmi; 21-01-2019 at 15:32.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Hi Eros,
No - I had not tried to send %NULL
In fact, never even thought of that!!!
YES - I'm happy. It works as I thought it would do.
Thank you for quick reply. Had forgotten about %NULL
Regards,
catventure/Phil.
http://tab.thinbasic.com - Home Of The ThinBasic Adventure Builder Project. (Interactive Fiction/Text Adventure Maker)
Happy it works.
When you assign an image handle to a control, the image is copied by Windows into the control in order to maintain that control as independent from the original image.
To remove the image from the control, just assign a %NULL and Windows will remove the assigned image and will also remove the image from its internal stock.
Ciao
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
When you assign an image handle to a control, the image is copied by Windows into the control in order to maintain that control as independent from the original image.
No, it does not copy anything. It simply stores the passed handle in the extra bytes of the control and returns the previous stored handle, if any.
prevIcon = (HICON)SetWindowLongPtrW( hwnd, HICON_GWL_OFFSET, (LONG_PTR)hicon );
...
return prevIcon
To remove the image from the control, just assign a %NULL and Windows will remove the assigned image and will also remove the image from its internal stock.
No, it does not remove any image. It will simply store a null value.
The caller is responsible of deleting the bitmap:
DeleteObject (SendMessage(hwnd, %ID_LISTVIEW3, %STM_SETIMAGE, %IMAGE_BITMAP, %NULL))
Change the above line to work with Control Send. Maybe something like
You must also delete the returned handle if instead of NULL you pass the handle of a new bitmap to replace an existing one:Control Send hwnd, %ID_LISTVIEW3, %STM_SETIMAGE, %IMAGE_BITMAP, hBitmap3 TO oldBitmap DeleteObject oldBitmap
DeleteObject (SendMessage(hwnd, %ID_LISTVIEW3, %STM_SETIMAGE, %IMAGE_BITMAP, newBitmapHandle))
Last edited by ErosOlmi; 24-01-2019 at 18:46.
Thanks a lot José for fixing my reply.
Ciao
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Ok. Thanks for info...
Eros, so what does the "GDIp_DeleteGraphics(graphic)" do? I can find no example of usage in the help file.
http://tab.thinbasic.com - Home Of The ThinBasic Adventure Builder Project. (Interactive Fiction/Text Adventure Maker)
That function is used to tell GDI+ engine to remove a graphics object not needed anymore.
Here info about what is a GDI+ graphics: https://docs.microsoft.com/en-us/dot...ts-for-drawing
thinBasic GDIp module is one module I want to implement and document much more in future thinBasic versions.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
When you relegate a picture handle to a control, the picture is duplicated by Windows into the control so as to keep up that control as free from the first picture Pnr Status TextNow VPN.
To expel the picture from the control, simply dole out a %NULL and Windows will evacuate the doled out picture and will likewise expel the picture from its inner stock.
Last edited by rossi; 06-02-2019 at 11:30.
What? Do you have read reply #5?
Bookmarks