#include "FiveWin.ch"
function Main()
local oDlg, oHand, oBmp1
DEFINE CURSOR oHand HAND
DEFINE DIALOG oDlg RESOURCE "Test"
REDEFINE BITMAP oBmp1 ID 110 OF oDlg FILENAME "visible.bmp"
oBmp1:oCursor = oHand
oBmp1:bLClicked = { | nRow, nCol | MsgInfo( GetArea( GetColor( nRow, nCol, oBmp1 ) ) ) }
ACTIVATE DIALOG oDlg CENTERED
return nil
function GetColor( nRow, nCol, oBmp )
local hDC := CreateCompatibleDC( oBmp:GetDC() )
local hBmp := ReadBitmap( 0, "oculto.bmp" )
local hOldBmp := SelectObject( hDC, hBmp )
local nRGBColor := GetPixel( hDC, nCol, nRow )
SelectObject( hDC, hOldBmp )
DeleteObject( hBmp )
DeleteDC( hDC )
oBmp:ReleaseDC()
return nRGBColor
function GetArea( nRGBColor )
do case
case nRGBColor == 5026082
return "pasillo exterior"
case nRGBColor == 65535 .or. nRGBColor == 62207
return "edificio social"
case nRGBColor == 2366701
return "zona D"
case nRGBColor == 1959605
return "zona C"
case nRGBColor == 15245824
return "zona A"
case nRGBColor == 12632256
return "zona F"
case nRGBColor == 13387839
return "zona G"
otherwise
return Str( nRGBColor ) + ", no definido aun en la funcion GetArea()"
endcase
return nil
test DIALOG 17, 36, 186, 147
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "TestMap"
FONT 8, "MS Sans Serif"
{
CONTROL "", 110, "TBitmap", WS_CHILD | WS_VISIBLE, 5, 5, 175, 120
}
Hola Antonio:Antonio Linares wrote:Aqui teneis el codigo fuente de TestMap.prg y TestMap.rc:
#include "FiveWin.ch"
function Main()
local oDlg, oHand, oBmp1, osay
DEFINE CURSOR oHand HAND
DEFINE DIALOG oDlg RESOURCE "Test"
REDEFINE SAY osay ID 3 of oDlg
REDEFINE BITMAP oBmp1 ID 110 OF oDlg FILENAME "visible.bmp"
oBmp1:oCursor = oHand
oBmp1:bLClicked = { | nRow, nCol | MsgInfo( GetArea( GetColor( nRow, nCol, oBmp1 ) ) ) }
oBmp1:bMMoved = { | nRow, nCol | ( osay:settext( GetArea( GetColor( nRow, nCol, oBmp1 ) ) ), ;
osay:setcolor( rgb(0,0,0), GetColor( nRow, nCol, oBmp1 ) ) ) }
ACTIVATE DIALOG oDlg CENTERED
return nil
function GetColor( nRow, nCol, oBmp )
local hDC := CreateCompatibleDC( oBmp:GetDC() )
local hBmp := ReadBitmap( 0, "oculto.bmp" )
local hOldBmp := SelectObject( hDC, hBmp )
local nRGBColor := GetPixel( hDC, nCol, nRow )
SelectObject( hDC, hOldBmp )
DeleteObject( hBmp )
DeleteDC( hDC )
oBmp:ReleaseDC()
return nRGBColor
function GetArea( nRGBColor )
do case
case nRGBColor == 5026082
return "pasillo exterior"
case nRGBColor == 65535 .or. nRGBColor == 62207
return "edificio social"
case nRGBColor == 2366701
return "zona D"
case nRGBColor == 1959605
return "zona C"
case nRGBColor == 15245824
return "zona A"
case nRGBColor == 12632256
return "zona F"
case nRGBColor == 13387839
return "zona G"
otherwise
return Str( nRGBColor ) + ", no definido aun en la funcion GetArea()"
endcase
return nil
// 186, 147
test DIALOG 17, 36, 186, 147
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "TestMap"
FONT 8, "MS Sans Serif"
{
LTEXT " ", 3, 3, 7, 170, 10
CONTROL "", 110, "TBitmap", WS_CHILD | WS_VISIBLE, 5, 20, 175, 120
CONTROL "", 120, "TBitmap", WS_CHILD | WS_VISIBLE, 5, 150, 175, 120
}
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 44 guests