Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
change image in bitmap static control
#4
something like this should be what your after
Function Dialog2
Code:
Copy      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Static 0x5400000E 0x0 40 40 16 16 ""
;4 Button 0x54032000 0x0 112 40 48 14 "Button" "Click to change image"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040202 "*" "" "" ""

str controls = "3"
str sb3
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,int- _hbb=LoadPictureFile("image location");;change to first image location
,SendMessage id(3 hDlg) STM_SETIMAGE IMAGE_BITMAP _hbb
,__GdiHandle-- _hbb1=SendMessage(id(3 hDlg) STM_GETIMAGE IMAGE_BITMAP 0); if(_hbb1!=_hbb) DeleteObject(_hbb)    
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 4 ;;Button
,_hbb=LoadPictureFile("image location");;change to new image location
,SendMessage id(3 hDlg) STM_SETIMAGE IMAGE_BITMAP _hbb
,_hbb1.Delete
,_hbb1=SendMessage(id(3 hDlg) STM_GETIMAGE IMAGE_BITMAP 0); if(_hbb1!=_hbb) DeleteObject(_hbb)
,InvalidateRect hDlg 0 1        
ret 1


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)