Hallo,
im PureBasic Examples/Advantage Examples, ist eine GUI Example, dort gibt es die MS-Office Menüs ....
MFG Lukaso
Grafik am Rand im Kontextmenü
Nextgen Guild Wars Fanseite: Guild Wars Tactics (Pseudo-Admin + Developer)
"Das Fluchen ist die einzige Sprache, die jeder Programmierer beherrscht." - Unbekannter Autor
"Das Fluchen ist die einzige Sprache, die jeder Programmierer beherrscht." - Unbekannter Autor
Nextgen Guild Wars Fanseite: Guild Wars Tactics (Pseudo-Admin + Developer)
"Das Fluchen ist die einzige Sprache, die jeder Programmierer beherrscht." - Unbekannter Autor
"Das Fluchen ist die einzige Sprache, die jeder Programmierer beherrscht." - Unbekannter Autor
@Danilo
Da du ja nich mit office arbeitest nen kleiner tip wo das menu auch so ist wie in office und zwar im PSDK wenn du mal in dem fensterteil wo die beschreibungen immer stehen rechte maustaste machst da kommt ein menu und genau den style versuche ich mir auch gerade für ein popupmenu zu bauen.
Hmm mal sehen wenn ich erfolgreich war werd ich das hier posten
Da du ja nich mit office arbeitest nen kleiner tip wo das menu auch so ist wie in office und zwar im PSDK wenn du mal in dem fensterteil wo die beschreibungen immer stehen rechte maustaste machst da kommt ein menu und genau den style versuche ich mir auch gerade für ein popupmenu zu bauen.
Hmm mal sehen wenn ich erfolgreich war werd ich das hier posten
Geht es auch das man an so ein menü kleine icons mittels:
vorne dran heften kann?
Code: Alles auswählen
SetMenuItemBitmaps_(Menu,Item,#MF_BYCOMMAND,UseImage(Image),UseImage(Image))
Danke Mark S.
-
- Beiträge: 752
- Registriert: 14.09.2004 21:39
- Kontaktdaten:
Das erinnert mich daran, wie ich krampfhaft versucht hatte, einen Code im CodeArchiv so umzuarbeiten, dass ich mit ihm Menus + Icons und Hintergrund machen konnte. Das war das Resultat:
Aber meine Kenntnisse haben nicht ausgereicht. Danilos, du bis ein Spatz, *keksgeb* .
Code: Alles auswählen
Global SelFrontColor.l, SelBkColor.l
Global NrmFrontColor.l, NrmBkColor.l
Global DisFrontColor.l, DisBkColor.l
Global BorderImage.l, BorderWidth.l, BorderHeight.l
Global IconHeight.l, IconWidth.l
Global SeperatorFrontColor.l, SeperatorBkColor.l, SeperatorHeight.l
Global TextDegree.l
Structure MyItem
hFont.l
Text.s
hIcoNrm.l
hIcoCheck.l
hIcoSel.l
hIcoDis.l
EndStructure
;Je nach Anzahl der Menüeinträge dimensionieren
Dim pmyitem.MyItem(255)
Procedure MenuStyleCallBack(wnd, msg, wParam, lParam, result)
fSelected = #False
If msg = #WM_MEASUREITEM
*lpmis.MEASUREITEMSTRUCT = lParam
If *lpmis\CtlType = #ODT_MENU
hdc = GetDC_(wnd)
*lmyitem.MyItem = *lpmis\itemData
hFontOld = SelectObject_(hdc,*lmyitem\hFont)
GetTextExtentPoint32_(hdc,*lmyitem\Text,Len(*lmyitem\Text),@size.SIZE);
*lpmis\itemWidth = size\cx + IconWidth * 2
If *lmyitem\Text = ""
*lpmis\itemHeight = SeperatorHeight
Else
*lpmis\itemHeight = IconHeight;size\cy
EndIf
SelectObject_(hdc,hOldFont)
ReleaseDC_(wnd,hdc)
ProcedureReturn #True
EndIf
ElseIf msg = #WM_DRAWITEM
*lpdis.DRAWITEMSTRUCT = lParam
If *lpdis\CtlType = #ODT_MENU
*llmyitem.MyItem = *lpdis\itemData
hOldFont = SelectObject_(*lpdis\hdc,*llmyitem\hFont)
If *llmyitem\Text = ""
SetTextColor_(*lpdis\hdc,SeperatorFrontColor)
SetBkColor_(*lpdis\hdc,SeperatorBkColor)
fSelected = #True
dwCheckXY = GetMenuCheckMarkDimensions_()
wCheckX = (dwCheckXY >> 16 & $FFFF) + 10
nTextX = wCheckX + *lpdis\rcItem\left
nTextY = *lpdis\rcItem\top
ExtTextOut_(*lpdis\hdc,nTextX,nTextY,#ETO_OPAQUE,*lpdis\rcItem,*llmyitem\Text,Len(*llmyitem\Text),0)
DrawIconEx_(*lpdis\hdc,*lpdis\rcItem\left-1,*lpdis\rcItem\top-1, BorderImage,BorderWidth,SeperatorHeight+1 ,0,0,3)
SelectObject_(*lpdis\hdc,hOldFont)
ElseIf *lpdis\itemState & #ODS_DISABLED
SetTextColor_(*lpdis\hdc,DisFrontColor)
SetBkColor_(*lpdis\hdc,DisBkColor)
fSelected = #True
dwCheckXY = GetMenuCheckMarkDimensions_()
wCheckX = (dwCheckXY >> 16 & $FFFF) + 10
nTextX = wCheckX + *lpdis\rcItem\left
nTextY = *lpdis\rcItem\top
ExtTextOut_(*lpdis\hdc,nTextX,nTextY,#ETO_OPAQUE,*lpdis\rcItem,*llmyitem\Text,Len(*llmyitem\Text),0)
DrawIconEx_(*lpdis\hdc,*lpdis\rcItem\left-1,*lpdis\rcItem\top-1, BorderImage,BorderWidth,BorderHeight ,0,0,3)
DrawIconEx_(*lpdis\hdc,*lpdis\rcItem\left+1,*lpdis\rcItem\top,*llmyitem\hIcoDis, IconWidth,IconHeight ,0,0,3)
SelectObject_(*lpdis\hdc,hOldFont)
ElseIf *lpdis\itemState & #ODS_SELECTED
SetTextColor_(*lpdis\hdc,SelFrontColor)
SetBkColor_(*lpdis\hdc,SelBkColor)
fSelected = #True
dwCheckXY = GetMenuCheckMarkDimensions_()
wCheckX = (dwCheckXY >> 16 & $FFFF) + 10
nTextX = wCheckX + *lpdis\rcItem\left
nTextY = *lpdis\rcItem\top
ExtTextOut_(*lpdis\hdc,nTextX,nTextY,#ETO_OPAQUE,*lpdis\rcItem,*llmyitem\Text,Len(*llmyitem\Text),0)
DrawIconEx_(*lpdis\hdc,*lpdis\rcItem\left+1,*lpdis\rcItem\top,*llmyitem\hIcoSel, IconWidth,IconHeight ,0,0,3)
SelectObject_(*lpdis\hdc,hOldFont)
ElseIf *lpdis\itemState & #ODS_CHECKED
SetTextColor_(*lpdis\hdc,SelFrontColor)
SetBkColor_(*lpdis\hdc,SelBkColor)
fSelected = #True
dwCheckXY = GetMenuCheckMarkDimensions_()
wCheckX = (dwCheckXY >> 16 & $FFFF) + 10
nTextX = wCheckX + *lpdis\rcItem\left
nTextY = *lpdis\rcItem\top
ExtTextOut_(*lpdis\hdc,nTextX,nTextY,#ETO_OPAQUE,*lpdis\rcItem,*llmyitem\Text,Len(*llmyitem\Text),0)
DrawIconEx_(*lpdis\hdc,*lpdis\rcItem\left+1,*lpdis\rcItem\top,*llmyitem\hIcoCheck, IconWidth,IconHeight ,0,0,3)
SelectObject_(*lpdis\hdc,hOldFont)
Else
SetTextColor_(*lpdis\hdc,NrmFrontColor)
SetBkColor_(*lpdis\hdc,NrmBkColor)
dwCheckXY = GetMenuCheckMarkDimensions_()
wCheckX = (dwCheckXY >> 16 & $FFFF) + 10
nTextX = wCheckX + *lpdis\rcItem\left
nTextY = *lpdis\rcItem\top
ExtTextOut_(*lpdis\hdc,nTextX,nTextY,#ETO_OPAQUE,*lpdis\rcItem,*llmyitem\Text,Len(*llmyitem\Text),0)
DrawIconEx_(*lpdis\hdc,*lpdis\rcItem\left-1,*lpdis\rcItem\top-1, BorderImage,BorderWidth,BorderHeight ,0,0,3)
DrawIconEx_(*lpdis\hdc,*lpdis\rcItem\left+1,*lpdis\rcItem\top,*llmyitem\hIcoNrm, IconWidth,IconHeight ,0,0,3)
SelectObject_(*lpdis\hdc,hOldFont)
EndIf
ProcedureReturn #True
EndIf
ElseIf msg = #WM_DESTROY
PostQuitMessage_(0)
Else
ProcedureReturn result
EndIf
EndProcedure
Procedure StyledMenuItem(num, txt.s, hFont, hIcoNrm, hIcoCheck, hIcoSel, hIcoDis)
MenuItem(num, txt.s)
pmyitem(num)\hFont = hFont
pmyitem(num)\Text = txt
pmyitem(num)\hIcoNrm = hIcoNrm
pmyitem(num)\hIcoCheck = hIcoCheck
pmyitem(num)\hIcoSel = hIcoSel
pmyitem(num)\hIcoDis = hIcoDis
If pmyitem(num)\Text = ""
ModifyMenu_(MenuID(), num, #MF_BYCOMMAND|#MF_OWNERDRAW|#MF_DISABLED , num, pmyitem(num))
Else
ModifyMenu_(MenuID(), num, #MF_BYCOMMAND|#MF_OWNERDRAW, num, pmyitem(num))
EndIf
EndProcedure
Procedure SetMenuBorder(borderimg, borderw, borderh)
BorderImage = borderimg
BorderWidth = borderw
BorderHeight = borderh
EndProcedure
Procedure SetMenuIcon(iconw, iconh)
IconHeight = iconh
IconWidth = iconw
EndProcedure
Procedure SetMenuSperator(sepfront,sepback, seph)
SeperatorHeight = seph
SeperatorFrontColor = sepfront
SeperatorBkColor = sepback
EndProcedure
Procedure SetMenuColor(selfront,selback, nrmfront,nrmback, disfront,disback)
SelFrontColor = selfront
SelBkColor = selback
NrmFrontColor = nrmfront
NrmBkColor = nrmback
DisFrontColor = disfront
DisBkColor = disback
EndProcedure