Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #10150
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | "Karl-Heinz" <invalid@invalid.invalid> |
| Newsgroups | comp.lang.clipper.visual-objects |
| Subject | Re: Create Bitmap |
| Date | Sat, 11 Feb 2017 13:42:00 +0100 |
| Lines | 70 |
| Message-ID | <eg8f5iFrosU1@mid.individual.net> (permalink) |
| References | <ef3b5261-5f92-4820-b572-fbcd8dae6b1c@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; format=flowed; charset="UTF-8"; reply-type=original |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net s236gB50Mg8a2jJpS1Z4vwNEzYXV2VesOlLJBW51rzxgBQmAE= |
| Cancel-Lock | sha1:u8JCPNrGmBMdD4KCPNEsRmX1KbU= |
| In-Reply-To | <ef3b5261-5f92-4820-b572-fbcd8dae6b1c@googlegroups.com> |
| X-Priority | 3 |
| X-MSMail-Priority | Normal |
| Importance | Normal |
| X-Newsreader | Microsoft Windows Live Mail 16.4.3564.1216 |
| X-MimeOLE | Produced By Microsoft MimeOLE V16.4.3564.1216 |
| Xref | csiph.com comp.lang.clipper.visual-objects:10150 |
Show key headers only | View raw
Hi Simon,
>
> Anyone able to help me create a small bitmap in VO code -
> I cant use any other library as I need to compile it into a ReportPro UDF
> function.
>
I translated a C-snippet that creates a colored Bitmap
FUNCTION CreateColoredBitmap ( nWidth AS INT , nHeight AS INT , dwColorref
AS DWORD ) AS PTR PASCAL
LOCAL hDC, hBitMap, hBrush, hTempHDC, hPreviousBitmap AS PTR
LOCAL struRect IS _winRect
SetRect ( @struRect , 0 , 0 , nWidth , nHeight )
hDC := GetDC ( NULL )
hTempHDC := CreateCompatibleDC( hDC)
hBitMap := CreateCompatibleBitmap( hDC, nWidth, nHeight )
hPreviousBitmap := SelectObject( hTempHDC, hBitMap )
// set the color
hBrush := CreateSolidBrush( dwColorref )
FillRect( hTempHDC, @struRect, hBrush )
DeleteObject( hBrush )
SelectObject( hTempHDC, hPreviousBitmap )
DeleteDC( hTempHDC )
DeleteDC ( hDC)
SetBitmapDimensionEx( hBitMap, nWidth, nHeight, NULL)
RETURN hBitMap
The result is a BMP-handle that can be used e.g. with a "Fixed Bitmap"
control
IF ( hBitMap := CreateColoredBitmap( 5, 5 , Color {
COLORGREEN}:colorref ) ) != NULL_PTR
oBitmap := Bitmap { hBitMap }
// Assign the Bitmap to a "Fixed Bitmap" control
oDCFixedBitmap1:SetBitmap ( oBitmap )
ENDIF
If you want to save the created BMP to disk you should include the "Fab
PaintLib.aef" and do something like:
IF ( hDib := DIBCreateFromHBitmap( hBitMap ) ) != NULL_PTR
DIBSaveAs ( hDib , String2Psz("your.bmp" ))
DIBDelete ( hDib )
ENDIF
regards
Karl-Heinz
Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Create Bitmap simon@abersoftware.co.uk - 2017-02-10 03:25 -0800
Re: Create Bitmap "Karl-Heinz" <invalid@invalid.invalid> - 2017-02-11 13:42 +0100
Re: Create Bitmap simon@abersoftware.co.uk - 2017-02-13 03:45 -0800
Re: Create Bitmap "Karl-Heinz" <invalid@invalid.invalid> - 2017-02-13 16:13 +0100
Re: Create Bitmap simon@abersoftware.co.uk - 2017-02-13 09:01 -0800
csiph-web