Source/ Codesnippets | | | | | OwnerDraw PopupMenu entier simple:
Herunterladen KompilierenMarqueSéparation {$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 aus: Bitmaps im menu: [...] |
| | | | |
| | | Nochmal besser & chicker: KompilierenMarqueSéparation {$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. Dossier: c:dokumente et einstellungen....prf (38) Objektcode: POLINK: warning: Unrecognized keyword '_MIT_ICON_A US_DLL' dans module-définition file 'C:DOKUME~1MARIODESKTOPM ENMIT~1.EXT'; ignored. Creating object: MEN.EXP Creating library: MEN.LIB
avertissement: faute im Assembler 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 ▲ |
| |
| | | je tippe la fois cela Pfad et/ ou bien Dateiname, den Du pour qui XPrf vergeben la hâte, Umlaute et/ ou bien Freizeichen contient - avec cela peux qui externe Linker pas tourner autour de.
dans folgenden Versionen de XPSE versuche je Pfad et Dateiname pour den Linker "egal" son trop laisser.
mon Tip: C:\dev\englishNamedProjectName\englishNamedSourceFileName.xprf |
| | | | |
| | E.T. | Na ensuite warens wohl qui Leerzeichen, quelle mir ici un "Lehrzeichen" gesetzt avons. mais wieder quoi 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 QuelltextOptions du sujet | 7.224 Views |
Themeninformationencet Thema hat 2 participant: |