PBX_DrawVisualObject
From PowerBuilder Native Interface
Exported methods:
PBX_DrawVisualObject method
Description
Syntax
PBX_DrawVisualObject(HDC hDC, LPCTSTR className, const PBX_DrawItemStruct& property)[Unmapped Entity: middot ]
Return Values
Examples
PBXEXPORT PBXRESULT PBXCALL PBX_DrawVisualObject
(
HDC hDC,
LPCTSTR xtraName,
const PBX_DrawItemStruct& property
)
{
// If this PBX is dynamically linked against the MFC
// DLLs, any functions exported from this PBX that
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
AFX_MANAGE_STATE( AfxGetStaticModuleState() );
// Variables to hold the Led control and a pointer
// to Device Context
CLed *myLed;
CDC* pDC;
// The name must not contain uppercase letters
if ( strcmp( xtraName, "u_cpp_led" ) == 0 )
{
CRect rc( property.x, property.y, property.x +
property.width, property.y + property.height );
//Create a new LED
myLed = new CLed();
// Get the handle from the hDC
pDC = CDC::FromHandle(hDC);
CWnd* pWnd = pDC->GetWindow();
// Create the window
myLed->Create(NULL, WS_CHILD | WS_VISIBLE |
SS_BITMAP, rc, pWnd);
// Function that handles the background
// rendering of the control
myLed->OnEraseBkgndIDE(pDC);
// Draw the LED in default mode (red, on, round)
myLed->DrawLed(pDC,0,0,0);
myLed->SetLed(0,0,0);
//done
delete myLed;
}
return PBX_OK;
}