Fuente/ Codesnippets | | | | | OwnerDraw PopupMenu bastante simplemente:
Descargar KompilierenMarcaSeparación {$cleq}
cls
popup "Hallo"
appendMenu 100,"Welt"
appendMenu 200,"Welt"
appendMenu 300,"Welt"
appendMenu 400,"Welt"
appendMenu 500,"Welt"
Var hIcon1& = @create("hIcon", "Icon_Test.dll", 0)
Var hIcon2& = @create("hIcon", "Icon_Test.dll", 1)
Var hIcon3& = @create("hIcon", "Icon_Test.dll", 2)
setWindowLong(hWnd,gwl_userData,setWindowLong(hWnd,gwl_wndProc,procaddr(hWnd.wndProc,4)))
modifyMenu(&hMenu,200,MF_BYCOMMAND | MF_OWNERDRAW,200,hIcon1&)
modifyMenu(&hMenu,300,MF_BYCOMMAND | MF_OWNERDRAW,300,hIcon2&)
modifyMenu(&hMenu,400,MF_BYCOMMAND | MF_OWNERDRAW,300,hIcon3&)
while 1
waitinput
wend
end
nProc hWnd.wndProc
Parameters wnd&,msg&,wp&,lp&
if msg&==WM_MEASUREITEM
return 1
elseif msg&==WM_DRAWITEM
if long(lp&,0)==ODT_MENU
var dc&=long(lp&,24)
setTextColor(dc&,iff(long(lp&,16)==257,$FF0000,$0000FF))
SetBkMode(dc&,TRANSPARENT)
selectObject(dc&,createPen(PS_SOLID,0,iff(long(lp&,16)==257,$777777,$CCCCCC)))
selectObject(dc&,CreateSolidBrush(iff(long(lp&,16)==257,$AAAAAA,$DDDDDD)))
Rectangle(dc&,Long(lp&,28),Long(lp&,32),Long(lp&,36),Long(lp&,40))
drawText(dc&,GetSystemMetrics(71)+4,Long(lp&,32),"Test")
drawIconEx(dc&,Long(lp&,28),Long(lp&,32),long(lp&,44),16,16,0,0,3)
endif
return 1
endif
return callWindowProc(getWindowLong(wnd&,gwl_userData),wnd&,msg&,wp&,lp&)
ENDPROC
Entstanden de: Bitmaps en el Menü: [...] |
| | | | |
| | | Nochmal mejor & chicker: KompilierenMarcaSeparación {$cleq}
cls
popup "Hallo"
appendODMenuItem(100,"Hallo",0)
appendODMenuItem(200,"Welt",create("hIcon", "A"))
appendODMenuItem(300,"Hallo",create("hIcon", "PROFAN"))
appendODMenuItem(400,"Welt",create("hIcon", "BAUM"))
appendODMenuItem(500,"Hallo",create("hIcon", "WASSER"))
appendODMenuItem(600,"Welt",create("hIcon", "A"))
appendODMenuItem(700,"Hallo",0)
setWindowLong(hWnd,gwl_userData,setWindowLong(hWnd,gwl_wndProc,procaddr(hWnd.wndProc,4)))
while 1
waitinput
wend
end
nProc hWnd.wndProc
Parameters wnd&,msg&,wp&,lp&
if msg&==WM_MEASUREITEM
long lp&,12=100,GetSystemMetrics(SM_CYMENUSIZE)+3
return 1
elseif msg&==WM_DRAWITEM
if long(lp&,0)==ODT_MENU
var itm&=long(lp&,20)
var dc&=long(lp&,24)
SetBkMode(dc&,TRANSPARENT)
if long(lp&,16)==257
selectObject(dc&,createPen(PS_SOLID,0,$555555))
selectObject(dc&,CreateSolidBrush($FF9933))
setTextColor(dc&,$FFFFFF)
elseif long(lp&,16)==256
selectObject(dc&,createPen(PS_SOLID,0,getSysColor(COLOR_MENU)))
selectObject(dc&,CreateSolidBrush(getSysColor(COLOR_MENU)))
setTextColor(dc&,0)
endif
var txt&=dim(101)
getMenuString(getMenu(hWnd),long(lp&,8),txt&,100,0)
Rectangle(dc&,Long(lp&,28),Long(lp&,32),Long(lp&,36),Long(lp&,40))
drawText(dc&,GetSystemMetrics(71)+8,Long(lp&,32)+3,string$(txt&,0))
drawIconEx(dc&,Long(lp&,28)+2,Long(lp&,32)+3,long(lp&,44),16,16,0,0,3)
dispose(txt&)
endif
return 1
endif
return callWindowProc(getWindowLong(wnd&,gwl_userData),wnd&,msg&,wp&,lp&)
endproc
proc appendODMenuItem
parameters itm&,txt$,icn&
appendMenu itm&,txt$
modifyMenu(&hMenu,itm&,MF_BYCOMMAND | MF_OWNERDRAW,itm&,icn&)
< s=s4 href='./../../funktionsreferenzen/XProfan/ENDPROC/'>ENDPROC
|
| | | | |
| | E.T. |
XProfan 11.2.1.8a.63 Praekompiler [XPSE] Copyright (C) 1998-2010 XProfan.Com, built DE. Expediente: c:dokumente y einstellungen....prf (38) Objektcode: POLINK: warning: Unrecognized keyword '_MIT_ICON_A US_DLL' en module-definition file 'C:DOKUME~1MARIODESKTOPM ENMIT~1.EXT'; ignored. Creating object: MEN.EXP Creating library: MEN.LIB
Warnung: Fehler en el Ensamblador Linker
[C ]ompile [I ]nterpr [L ]ink [R ]unPrc Run[E ]xe [S ]ource [H ]ilfe XPSE:> |
| | | Grüße aus Sachsen... Mario WinXP, Win7 (64 Bit),Win8(.1),Win10, Win 11, Profan 6 - X4, XPSE, und 'nen schwarzes, blinkendes Dingens, wo ich das alles reinschütte... | 12.10.2010 ▲ |
| |
| | | Yo tippe veces el Pfad y/ oder Dateiname, el Usted para el XPrf vergeben hast, Umlaute y/ oder Freizeichen enthält - así kann el externe Linker no umgehen.
In folgenden Versionen de XPSE versuche Yo Pfad y Dateiname para el Linker "egal" ser que se.
Mein Tip: C:\dev\englishNamedProjectName\englishNamedSourceFileName.xprf |
| | | | |
| | E.T. | Na entonces warens wohl el Leerzeichen, welche me hier una "Lehrzeichen" gesetzt haben. Aber otra vez qué gelernt... |
| | | Grüße aus Sachsen... Mario WinXP, Win7 (64 Bit),Win8(.1),Win10, Win 11, Profan 6 - X4, XPSE, und 'nen schwarzes, blinkendes Dingens, wo ich das alles reinschütte... | 12.10.2010 ▲ |
| |
|
Zum QuelltextThemeninformationenDieses Thema ha 2 subscriber: |