Hey, I was playing with the DEMO at https://github.com/JoseRoca/WinFBX/blob/master/docs/Graphics/CImageCtx%20Class.md and would like to have it be "borderless" or "windowless"... so I can display a slideshow of pics without any borders...
Is there an "easy" way? : )
It is a custom control that must be child of another window (usually the main window) and uses its own window to display the images. Therefore, it can be windowless.
Hi all
I need to open a small .bmp file, no need to display it anywhere, and print it to the default printer.
Should I use this class to open it?
How do I proceed to printing it?
(For now, no placing just top left so i can see how that works)
Thanks you for the help.
-Peter
You can use the CMemBmp class:
https://github.com/JoseRoca/WinFBX/blob/master/docs/Graphics/CMemBmp%20Class.md#PrintBitmap
' Load the image with
DIM pMemBmp AS CMemBmp = CMemBmp(< path of the image >)
' and print it with
pMemBmp.PrintBitmap
Hi José
Wow, that worked perfectly.
I am busy with ZINT and from my understanding, it has a means to create a bitmap in memory without the need to save it to file.
Next step will be to figure out how to take the in-memory bitmap created by ZINT and print that on a specific position on a custom label.
Thanks, Peter
If you look at Jose's CMemBmp class for the PrintBitmap method you can see that he is using GDI+ to handle the output.
#include once "Afx/AfxGdiplus.inc"
PRIVATE FUNCTION CMemBmp.PrintBitmap (BYVAL bStretch AS BOOLEAN = FALSE, BYVAL nStretchMode AS LONG = InterpolationModeHighQualityBicubic) AS BOOLEAN
FUNCTION = AfxGdipPrintHBITMAP(m_hBmp, bStretch, nStretchMode)
END FUNCTION
So, maybe this is as simple as using the AfxGdipPrintHBITMAP function directly passing it the pointer of the bitmap that zint creates (this is a member inside the zint_symbol struture).
Something like:
#include once "Afx/AfxGdiplus.inc"
dim as zint_symbol ptr my_symbol = ZBarcode_Create()
ZBarcode_Encode_and_Buffer(my_symbol, "1010101", 0, 0)
dim as boolean result = AfxGdipPrintHBITMAP(my_symbol->pBitmap)
ZBarcode_Delete(my_symbol)
With regards to positioning, you might want to look at the code for Jose's AfxGdipPrintHBITMAP function and see where it could be modified to change the location offset (looks like the last two parameters of the GdipDrawImage call at Line 943).
BTW, have you converted the ZINT headers from C to FB, or are you trying to use the PB converted version?
I wrote the AfxGdipPrintHBITMAP function mainly to remember what is needed to print a bitmap (I used GDI+ because this way the image file can be also a .jpg, etc.).
You can use it as a template to write other functions that suit your needs, e.g. one that accepts the name of a printer instead of the default printer, or that accepts values for the x, y coordinates, and/or the cx, cy dimensions (width and height)...
Hi All
I am not persuing Powerbasic anymore.
I am using the FB code Johan Klassen provided.
It makes the most perfect barcodes, and the rest of the app is simple to remake in FB.
I could see the pointer to the bitmap that zint created, I just needed to figure out how to access it and print it.
Let me go test this first, and then I will need your guidance on how to print everything on a label.
-Regards Peter
Quote from: Petrus Vorster on June 12, 2023, 04:28:51 PMLet me go test this first, and then I will need your guidance on how to print everything on a label.
When you're ready, I will create a function based on Jose's AfxGdipPrintHBITMAP function in order to specify the printer, print coordinates and label bitmap size. We'll get it all working eventually. It will be cool when it all works.