Silvio...
1. becarefull with the bitmap filename... in you sample the bmp name is "badge006.bmp" and the define is "badge000.bmp"
2. in function nInches2Pixels you need a valid Dialog HDC... you should do oDlg:GetDC() before and oDlg:ReleaseDC() after use
3. you need to learn debug you own code ( 2 suggestions )
3.1 verify all parameters values sent and returned
3.2 trace step by step all process
- Code: Select all Expand view RUN
#include "FiveWin.ch"
#define BADGE_H 3.375 //8 CM
#define BADGE_V 2.125 //5,39 CM
#define HORZSIZE 4
#define VERTSIZE 6
#define HORZRES 8
#define VERTRES 10
#define LOGPIXELSX 88
#define LOGPIXELSY 90
#define Badge0001 "badge006.bmp"
STATIC oBack
Function test()
Local oDlg
DEFINE DIALOG oDlg FROM 317, 612 TO 830, 1250 PIXEL
oDlg:SetColor(0,RGB(143,172,230))
oDlg:GetDC()
SIZE_H := nInches2Pixels( oDlg:hdc, BADGE_H, .F. )
SIZE_V := nInches2Pixels( oDlg:hdc, BADGE_V, .T. )
oDlg:ReleaseDC()
@ 2.3,1.5 BITMAP oBack FILENAME Badge0001 TRANSPARENT SIZE SIZE_H, SIZE_V NOBORDER
oBack:ltransparent:=.T.
ACTIVATE DIALOG oDlg CENTERED
FUNCTION nInches2Pixels( hDC, nInches, lVertical )
Return (nInches * GetDeviceCaps( hDC, If(lVertical, LOGPIXELSY, LOGPIXELSX) ) )