¿Es correcto?
// c:\fwh\samples\monitor.prg
#include "Fivewin.ch"
#include "Common.ch"
STATIC oFont, oWnd, nDpi
FUNCTION Main()
LOCAL oIco, oBar, oBmp, oPopUp, oPopUp2, oPopUp3, oPopUp4, oPopUp5, oMenu
LOCAL oBtn := ARRAY(05)
LOCAL cWidth := 500, cHeight := 500
// PRIVATE nDpi
nDpi := GetDpiForSystem()
menu oMenu
MenuItem "From Code" action FromCode( oWnd )
MenuItem "From Resource" action FromrES( oWnd )
endmenu
// DEFINE ICON oIco NAME "A"
DEFINE ICON oIco FILE "..\icons\fax.ico"
DEFINE FONT oFont NAME "Tahoma" SIZE 0, ScaleFontSize( -12, nDpi )
DEFINE WINDOW oWnd TITLE "Prueba MyBox" SIZE 600, 400 ICON oIco PIXEL ;
menu oMenu
oWnd:SetFont( oFont )
DEFINE BUTTONBAR oBar _3D SIZE 50, 40 OF oWnd 2007
DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\new.bmp" FLAT ;
ACTION ( nil ) ;
TOOLTIP "Creates a new document"
DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\open.bmp" FLAT ;
ACTION MsgInfo( cGetFile( "*.*", "Select a document to open" ) ) ;
TOOLTIP "Opens a document" WHEN .f.
// Aqui Jairo.
GetnWidthItem( 0.8 ) // Ajusta con un valor < 1, y comprueba 0.8
MENU oPopUp POPUP 2007 COLORS HEIGHT 2.27 FONT oFont
MENUITEM "Cadastro de Clientes" ;
FILENAME "..\bitmaps\16x16\new.bmp" ;
MESSAGE "Cadastro de Clientes - Pesquisas." ;
ACTION MsgInfo( Time() )
SEPARATOR
MENUITEM "Cadastro de Grupos" ;
FILENAME "..\bitmaps\16x16\open.bmp" ;
MESSAGE "Cadastro de Grupos - Textos Auxiliares." ;
ACTION MsgInfo( Time() )
SEPARATOR
MENUITEM "Cadastro de Ferramentas" ;
FILENAME "..\bitmaps\16x16\printer.bmp" ;
MESSAGE OemToAnsi( "Cadastro de Ferramentas da Proposta" ) ;
ACTION MsgInfo( Time() )
SEPARATOR
MENUITEM "Cadastro de Mão de Obra" ;
FILENAME "..\bitmaps\16x16\prop.bmp" ;
MESSAGE OemToAnsi( "Cadastro de MÆo de Obra" ) ;
ACTION MsgInfo( Time() )
SEPARATOR
MENUITEM "Cadastro de Paisagistas" ;
FILENAME "..\bitmaps\16x16\Help.bmp" ;
MESSAGE OemToAnsi( "Cadastro de Paisagistas da Empresa" ) ;
ACTION MsgInfo( Time() )
ENDMENU
// Aqui Jairo.
DEFINE BUTTON oBtn[03] OF oBar ACTION oBtn[03]:ShowPopup() FLAT GROUP ;
FILENAME "..\bitmaps\16x16\floppy.bmp" ;
MESSAGE "Saves this document" ;
TOOLTIP "Saves this document" ;
MENU oPopup
DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\printer.bmp" FLAT GROUP ;
ACTION MsgInfo( "Prints this document" ) TOOLTIP "Print this document"
DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\prop.bmp" FLAT GROUP ;
ACTION PrinterSetup() TOOLTIP "Setup the printer"
DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\HelpInd.bmp" FLAT ;
ACTION MsgInfo( Version() ) TOOLTIP "A multiple lines" + ;
Chr( 13 ) + Chr( 10 ) + "tooltip!" GROUP
DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\Help.bmp" FLAT ;
ACTION MsgInfo( "fivewin power!" ) TOOLTIP "fivewin power!"
DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\Exit.bmp" FLAT ;
ACTION oWnd:End() TOOLTIP "Exit this app" GROUP
DEFINE MESSAGE OF oWnd ;
PROMPT FWVERSION + " " + FWCOPYRIGHT ;
NOINSET CENTERED KEYBOARD DATE CLOCK 2007
DEFINE BITMAP oBmp FILENAME "..\bitmaps\fiveback.bmp"
oWnd:bPainted = { | hDC | BmpTiled( hDC, oWnd, oBmp ) }
ACTIVATE WINDOW oWnd CENTERED // MAXIMIZED
RETURN NIL
Function FromCode( oWnd )
local oDlg
local oGet1, oGet2, oGet3, oGet4
local cVar1, cVar2, cVar3, cVar4
local lActive := .f.
cVar1 := 0
cVar2 := 0
cVar3 := 0
cVar4 := 0
define dialog oDlg title "From Code" pixel size 300, 300 FONT oFont
oDlg:lHelpIcon := .F.
@ 10,10 get oGet1 var cVar1 bitmap "..\bitmaps\on.bmp" action( msginfo( "With Transparent" ) ) of oDlg pixel size 60,12
@ 40,10 get oGet2 var cVar2 bitmap "..\bitmaps\on.bmp" action( msginfo( "Without Transparent" ) ) of oDlg pixel size 60,12
@ 70,10 get oGet3 var cVar3 bitmap "..\bitmaps\chkyes.bmp" action( msginfo( "With Adjust-Transparent" ) ) of oDlg pixel size 120,12
@ 100,10 get oGet4 var cVar4 bitmap "..\bitmaps\chkyes.bmp" ;
action( if( lActive,oGet3:disable(),oGet3:enable()), lActive:= !lActive, oDlg:update() ) of oDlg pixel size 120,12
oGet1:lBtnTransparent := .t. // transparent button get oGet1
oGet3:disable()
oGet3:lBtnTransparent := .t. // transparent button get oGet3
oGet3:lAdjustBtn := .t. // Button Get Adjust Witdh oGet3
oGet3:lDisColors := .f. // Deactive disable color
oGet3:nClrTextDis := CLR_WHITE // Color text disable status
oGet3:nClrPaneDis := CLR_BLUE // Color Pane disable status
oGet4:lAdjustBtn := .t.
activate dialog oDlg centered
return nil
Function FromRes( oWnd )
local oDlg
local oGet1, oGet2, oGet3, oGet4
local cVar1, cVar2, cVar3, cVar4
local lActive := .f.
cVar1 := 0
cVar2 := 0
cVar3 := 0
cVar4 := 0
define dialog oDlg resource "fromres" of oWnd FONT oFont
oDlg:lHelpIcon := .F.
redefine get oGet1 var cVar1 id 100 bitmap "on" action( msginfo( "With Transparent" ) ) of oDlg
redefine get oGet2 var cVar2 id 101 bitmap "on" action( msginfo( "Without Transparent" ) ) of oDlg
redefine get oGet3 var cVar3 id 102 bitmap "chkyes" action( msginfo( "With Adjust-Transparent" ) );
COLOR CLR_BLACK, CLR_CYAN of oDlg
redefine get oGet4 var cVar4 id 103 bitmap "chkyes" ;
action( if( lActive,oGet3:disable(),oGet3:enable()), lActive:= !lActive, oDlg:update() ) of oDlg
oGet1:lBtnTransparent := .t. // transparent button get oGet1
oGet3:disable()
oGet3:lBtnTransparent := .t. // transparent button get oGet3
oGet3:lAdjustBtn := .t. // Button Get Adjust Witdh oGet3
oGet3:lDisColors := .f. // Deactive disable color
oGet3:nClrTextDis := CLR_WHITE // Color text disable status
oGet3:nClrPaneDis := CLR_BLUE // Color Pane disable status
oGet4:lAdjustBtn := .t.
activate dialog oDlg centered
return nil
STATIC FUNCTION BmpTiled( hDC, oWnd, oBmp )
local nWidth := oWnd:nWidth(), nHeight := oWnd:nHeight()
local nRow := 0, nCol := 0, n
local nBmpWidth := oBmp:nWidth(), nBmpHeight := oBmp:nHeight()
if oBmp:hBitmap == 0
return nil
endif
while nRow < nHeight
nCol = 0
while nCol < nWidth
PalBmpDraw( hDC, nRow, nCol, oBmp:hBitmap )
nCol += nBmpWidth
end
nRow += nBmpHeight
end
return nil
DLL32 FUNCTION GetDpiForSystem() AS LONG PASCAL LIB "User32.dll"
FUNCTION ScaleFontSize( nBaseSize, nDpi )
RETURN Int( nBaseSize * nDpi / 96 )
// FIN / ENDRegards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341