Hi to all!
It there a way to get the bitmap sizes (width & height) read by ReadBitmap() function ?
TIA & Regards, Euclides
Bitmap sizes
BMP Widht and height
Hello,
I think, that works.
I used it in my old ONPAINT-function :
nBMPWIDTH := oBmp:Super:nWidth()
nBMPHIGHT := oBmp:Super:nHeight()
Before FWH 8.07, i used it for painting text on gradient-bmp's.
With FWH 8.07 it is easy to handle.
If you don't work with FWH 8.07, you can use this function.
The function includes some more informations, about
Bitmap-handling. Maybe you find something, you can use.
For this BMP, I had to do :
Best regards
Uwe![Laughing :lol:](./images/smilies/icon_lol.gif)
I think, that works.
I used it in my old ONPAINT-function :
nBMPWIDTH := oBmp:Super:nWidth()
nBMPHIGHT := oBmp:Super:nHeight()
Before FWH 8.07, i used it for painting text on gradient-bmp's.
With FWH 8.07 it is easy to handle.
If you don't work with FWH 8.07, you can use this function.
The function includes some more informations, about
Bitmap-handling. Maybe you find something, you can use.
For this BMP, I had to do :
![Image](http://www.pflegeplus.com/pictures/gradient70.jpg)
Code: Select all | Expand
// using FWH-function : Gradient( hDC, aRect, nVColor, nBColor, .T. )
// -----------------------------------------------------------------------
// nVcolor = 1. Gradient-color
// nBColor = 2. Gradient-color
// nColor = Text-color
// cText = String
// e_oBfont2 = Font
// B_Posleft = Left Start-pos. of text
// B_Orient = Hor. / Vert.
// B_Brush = Brush used if no gradient needed
// B_pen = Box-frame
// B_End = Row-position of browser-selection
FUNCTION ONPAINTT( hDC,oBmp, nVcolor, nBColor, nColor, cText, ;
e_oBfont2, B_POSLEFT, B_END,B_ORIENT, B_BRUSH, B_PEN )
LOCAL hOldFont, oNewbrush
hOldFont := SelectObject( hDC, e_oBFont2:hFont )
nTXTLG := GettextWidth( hDC, cText )
// Your values !!!!
// ------------------
nBMPWIDTH := oBmp:Super:nWidth()
nBMPHIGHT := oBmp:Super:nHeight()
nFONTHIGHT := e_oBfont2:nInpHeight * -1
nLEFT := 0
IF B_POSLEFT = 0
nLEFT := nBMPHIGHT - ((nBMPHIGHT - nTXTLG) / 2)
ELSE
nLEFT := nBMPHIGHT - nLeft
ENDIF
nNEWHIGHT := nFONTHIGHT
nTOP := (nBMPWIDTH - nNEWHIGHT) / 2
// Browser selection ( brushes if not using colors )
// ---------------------------------------------------------
IF B_END = 8
DEFINE BRUSH oNewBrush STYLE BORLAND
ENDIF
IF B_END = 9
DEFINE BRUSH oNewBrush STYLE TILED
ENDIF
IF B_END = 10
DEFINE BRUSH oNewBrush STYLE BRICKS
ENDIF
IF B_END = 12
DEFINE BRUSH oNewBrush FILE B_BRUSH
ENDIF
aRect := GETCLIENTRECT( oBmp:hWnd )
IF B_END <> 8 .and. B_END <> 9 .and. B_END <> 10 ;
.and. B_END <> 12
// Horizontal
nGRADIENT := Gradient( hDC, aRect, nVColor, nBColor, .T. )
IF B_ORIENT = 2
// Vertical
nGRADIENT := Gradient( hDC, aRect, nVColor, BColor, .F. )
ENDIF
oBmp:oBrush := TBrush():New( , nGRADIENT )
ELSE
oBmp:oBrush := oNewbrush
ENDIF
FillRect( hDC, aRect, oBmp:oBrush:hBrush )
SetBkMode( hDC, 0 ) // 1 = Transparent
SetTextColor( hDC,nColor)
TextOut( hDC, nLEFT, nTOP, cText )
SelectObject( hDC, hOldFont )
IF B_PEN > 0
DRAWBOX( aRect, hDC, nColor, nBMPWIDTH, nBMPHIGHT, B_PEN )
ENDIF
RETURN NIL
Best regards
Uwe
![Laughing :lol:](./images/smilies/icon_lol.gif)
Last edited by ukoenig on Wed Aug 13, 2008 4:06 pm, edited 3 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Bitmap sizes
Euclides wrote:Hi to all!
It there a way to get the bitmap sizes (width & height) read by ReadBitmap() function ?
TIA & Regards, Euclides
nBmpWidth( hBmp )
nBmpHeight( hBmp )
Source: \fwh\source\function\fwbmp.c
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India