Click to See Complete Forum and Search --> : Creating bitmaps on-the-fly
pjn
May 30th, 2001, 10:59 AM
Slightly off-topic I guess, but does anyone know of a program that will accept a text string, and create a bitmap of a specified size that just contains that string?
The reason is that we want to create a bitmap for use as a fill-pattern in reports - this will contain the customer's name word-wrapped and repeated to fill the box.
Any help would be gratefully appreciated.
Regards
Pete
razzaj
May 30th, 2001, 01:29 PM
I am looking for something like this only I need to create BMP or GIF Files With lines and colors ...
pjn
May 31st, 2001, 04:43 AM
I've decided to do this another way - I'm just populating a variable with the replicated string, painting it on the report and sending to the back. (so obvious that I never thought about doing it at first!)
EDais
May 31st, 2001, 05:35 AM
Ok, create a memory DC and bitmap, select the bitmap into the DC, draw on it using TextOut() then either extract the image bits and write the bitmap manually in binary mode, or draw it to a picture box and use it's SavePicture() method.
Hope this helps,
Mike
pjn
May 31st, 2001, 05:49 AM
EDais
Thanks - that method didn't even cross my mind! I like the SavePicture idea.
Pete
EDais
May 31st, 2001, 06:49 AM
Razzaj, in response to your question then basically do the same thing, but use the MoveToEx() and LineTo() API call's for drawing lines and API pen objects for changing the colours.
Don't bother with trying to save to a .GIF image, if you do then you'll be breaking the law (the .GIF format it patented, it stops developers using it without paying lots of money for a licence) The .JPG format is and open format though if your looking for something to go on the web, you can use the Intel JPEG library which is available on their page and has native support for VB since the last version. Alternatively if you’re looking for something more like the .GIF format then there's a class module on my page written by Warren Galyen that encapsulates .PNG support.
Hope this helps,
Mike
Megatron
May 31st, 2001, 03:55 PM
Or you can use the Print method of the PictureBox, then size the PictureBox (with TextWidth, and Height) then use SavePicture to save it.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.