This will create an imagebutton control using only API commands, no DirectX:
Const LR_LOADFROMFILE=16
Const IMAGE_BUTTON=0
Const GWL_STYLE=-16
Const BS_BITMAP=128
Const BM_SETIMAGE=247
win=CreateWindow("",200,200,400,300)
CreateImageButton("C:\Program Files\BlitzPlus\samples\mak\blitzlogo.bmp",0,0,ClientWidth(win),ClientHeight(win),win)
Repeat
Until WaitEvent()=$803
Function CreateImageButton(imagefile$,x,y,width,height,group)
i=LoadImageA(0,imagefile$,IMAGE_BITMAP,0,0,LR_LOADFROMFILE)
If Not i Return
button=CreateButton("",x,y,width,height,group)
hbutton=QueryObject(button,1)
flags=GetWindowLong(hbutton,GWL_STYLE)+BS_BITMAP
SetWindowLong hbutton,GWL_STYLE,flags
SendMessage(hbutton,BM_SETIMAGE,IMAGE_BITMAP,i)
Return button
End Function
|