Forum | | | | Detlef Jagolski | Salut,
Frage à unsere Experten:
une Anwendung übergibt qui Botschaft WM_MDISETMENU, um cela menu des MDI-Rahmenfensters (Multidokumentschnittstelle), cela Pop-up-menu des Fensters ou bien beide auszutauschen. Ist es possible cela menu comme Owner Draw festzulegen. Alle anderen Menüpunkte sommes Owner Draw. j'ai bisher aucun API Funktion trouvé.
...et si oui, comment allez cela... Salut
Detlef KompilierenMarqueSéparation
Proc MDIChildProc
Parameters Wnd&, Message&, wParam&, lParam&
If Message& = ~WM_CREATE
EndIf
If Message& = ~WM_MDIACTIVATE
If wParam& = &FALSE
hChildMenu& = ~GetSubMenu(hMenu&,1)
hNewChildMenu& = MakeLong(hChildMenu&,~GetSubMenu(~GetMenu(Wnd&),1))
SendMessage(hWndClient&,~WM_MDISETMENU,0,hNewChildMenu&)
~DrawMenuBar(hNewChildMenu&)
………………………………………………..
EndIf
ElseIf Message& = ~WM_CLOSE
SendMessage(hWndClient&,~WM_MDIDESTROY,Wnd&,0)
cc& = cc& - 1
Else
Return ~DefMDIChildProc(Wnd&, Message&, wParam&, lParam&)
EndIf
ENDPROC
|
| | | XProfan X4, PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11 | 24.08.2005 ▲ |
| |
| | | je crois j'ai qui Frage pas wirklich verstanden.
Salve, iF.
PS: s'il te plaît Codes avec dem KompilierenMarqueSéparation umfassen.
Salve, iF. |
| | | | |
| | Detlef Jagolski | allô IF,
alors je voudrais alle Menüpunkte comme Owner Draw avec Icon représenter, pas cela Standard menu. là mais cela menu pour qui MDI la fenêtre vom System erstellt wird, peux je cet Menüpunkte pas changement.
Salut
Detlef |
| | | XProfan X4, PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11 | 24.08.2005 ▲ |
| |
| | | Ok - cela habe je verstanden.
Frage1: Doit es juste OD son - weil belle Icônes bekommst Du aussi sans OD dans qui Menüpunkte... Frage2: la hâte Du déjà un OD-menu entwickelt?
Salve, iF. |
| | | | |
| | Detlef Jagolski | allô iF,
Frage1: cela soll es déjà son. Frage2: OD-Menu habe je entwickelt. KompilierenMarqueSéparationStruct MenuItemInfo = cbSize&, fMask&, fType&, fState&, wID&, hSubMenu&, hbmpChecked&, hbmpUnchecked&, dwItemData&, dwTypeData&, cch&
Struct MeasureItemStruct = ~MEASUREITEMSTRUCT
Struct DrawItemStruct = ~DRAWITEMSTRUCT
Struct Rect = ~RECT
Struct Size = ~SIZE
Struct MenuData = MenuText$(255), IconIndex&, MenuPopUp&, MenuFont&, fType&
Struct ICONINFO = ~ICONINFO
Struct BITMAP = ~BITMAP
Declare MenuItemInfo#
Declare lpmis#
Declare lpdis#
Declare Rect#
Declare TRect#
Declare GRect#
Declare Size#
Declare MenuData#[150]
Declare MyMenuData#
Declare MenuText#
Declare IconName$
Declare hImagelist&
Declare hImagelist2&
Declare CheckedImage&
Declare hIcon&
Declare hIconGray&
Declare hDll&
Declare hBitmapDll&
Declare BitmapFile$
Declare Iczz%
Declare Iccnt%
Declare Menu%
Declare MenuDC&
Declare MenuIcon&
Declare dwCheckXY&
Declare nTextWidth&
Declare nTextHeight&
Declare nImageWidth&
Declare nImageHeight&
Declare wCheckX&
Declare Bitmap$
Declare XMbgBMP&
Declare XMBrush&
Declare ItemText$
Declare MenuPen&
Declare MenuFont&
Declare OldMenuPen&
Declare hOldFont&
Declare LeftItext$
Declare RightItext$
Declare Color_IconBack&
Declare Color_Line&
Declare Color_Selected&
Declare Color_FrameRect&
Declare S#
Declare ToolBar&
Declare ToolinfoButton#
Declare t#
Declare Text#
Declare TipControl&
Dim MenuItemInfo#,MenuItemInfo
Dim lpmis#,24
Dim lpdis#,DrawItemStruct
Dim Rect#,Rect
Dim TRect#,Rect
Dim GRect#,Rect
Dim Size#,Size
Dim MenuData#[],MenuData
Dim MyMenuData#,MenuData
Dim MenuText#,255
Menu% = 0
Proc CreateGrayscaleIcon
Parameters hIcon&
Declare IconInfo#
Declare IconInfo2#
Declare Bitmap#
Declare bRetValue&
Declare hMainDC&
Declare hMemDC1&
Declare hMemDC2&
Declare dwWidth&
Declare dwHeight&
Declare hOldBmp1&
Declare hOldBmp2&
Declare dwLoopY&
Declare dwLoopX&
Declare crPixel&
Declare byNewPixel&
Declare hGrayIcon&
Dim IconInfo#,ICONINFO
Dim IconInfo2#,ICONINFO
Dim Bitmap#,BITMAP
bRetValue& = ~GetIconInfo(hIcon&,IconInfo#)
Case bRetValue& = 0: Return 0
hMainDC& = ~GetDC(0)
hMemDC1& = ~CreateCompatibleDC(hMainDC&)
hMemDC2& = ~CreateCompatibleDC(hMainDC&)
~GetObject(IconInfo#.hbmColor&, SizeOf(Bitmap#), Bitmap#)
dwWidth& = IconInfo#.xHotspot& * 2
dwHeight& = IconInfo#.yHotspot& * 2
IconInfo2#.hbmColor& = ~CreateBitmap(dwWidth&, dwHeight&, Bitmap#.bmPlanes%,Bitmap#.bmBitsPixel%,0)
hOldBmp1& = ~SelectObject(hMemDC1&, IconInfo#.hbmColor&)
hOldBmp2& = ~SelectObject(hMemDC2&, IconInfo2#.hbmColor&)
~BitBlt(hMemDC2&,0,0,dwWidth&,dwHeight&,hMemDC1&,0,0,~SRCCOPY)
crPixel& = 0
byNewPixel& = 0
dwLoopY& = 0
Whileloop dwHeight&
dwLoopX& = 0
Whileloop dwWidth&
crPixel& = ~GetPixel(hMemDC1&,dwLoopX&,dwLoopY&)
byNewPixel& = (GetRValue(crPixel&) + GetGValue(crPixel&) + GetBValue(crPixel&)) / 3
~SetPixel(hMemDC2&,dwLoopX&,dwLoopY&,RGB(byNewPixel&,byNewPixel&,byNewPixel&))
Inc dwLoopX&
EndWhile
Inc dwLoopY&
EndWhile
~SelectObject(hMemDC1&, hOldBmp1&)
~SelectObject(hMemDC2&, hOldBmp2&)
IconInfo2#.hbmMask& = IconInfo#.hbmMask&
IconInfo2#.fIcon& = 1
hGrayIcon& = ~CreateIconIndirect(IconInfo2#)
~DeleteObject(IconInfo2#.hbmColor&)
~DeleteObject(IconInfo2#.hbmMask&)
~DeleteObject(IconInfo#.hbmColor&)
~DeleteObject(IconInfo#.hbmMask&)
~DeleteDC(hMemDC1&)
~DeleteDC(hMemDC2&)
~ReleaseDC(0,hMainDC&)
Dispose IconInfo#
Dispose IconInfo2#
Dispose Bitmap#
Return hGrayIcon&
EndProc
Proc MeasureItem
MenuDC& = ~GetDC(Wnd&)
lpmis# = lParam&
If Long(lpmis#,0) = ~ODT_MENU
MyMenuData# = Long(lParam&,20)
dwCheckXY& = ~GetMenuCheckMarkDimensions()
nImageWidth& = HiWord(dwCheckXY&)
nImageHeight& = LoWord(dwCheckXY&)
wCheckX& = HiWord(dwCheckXY&)+ 10
ItemText$ = MyMenuData#.MenuText$
MenuFont& = MyMenuData#.MenuFont&
hOldFont& = ~SelectObject(MenuDC&,MenuFont&)
~GetTextExtentPoint32(MenuDC&,Addr(ItemText$),Len(ItemText$),Size#)
If MyMenuData#.fType& = ~MFT_SEPARATOR
Case Int(Val($WinVer)) = 4: Long lpmis#,12 = Size#.cx& + wCheckX& + nImageWidth& + 45
Case Int(Val($WinVer)) = 4: Long lpmis#,16 = Size#.cy& + 10
Case Int(Val($WinVer)) = 5: Long lpmis#,12 = Size#.cx&
Case Int(Val($WinVer)) = 5: Long lpmis#,16 = Size#.cy& - 5
Else
Long lpmis#,12 = Size#.cx& + wCheckX& + nImageWidth& + 45
Long lpmis#,16 = Size#.cy& + 10
~SelectObject(%HDC,hOldFont&)
EndIf
Return 1
EndIf
EndProc
Proc DrawItem
lpdis# = lParam&
If Long(lpdis#,0) = ~ODT_MENU
MyMenuData# = Long(lpdis#,44)
nTextWidth& = wCheckX& + Long(lpdis#,28)
nTextHeight& = Long(lpdis#,32)
MenuIcon& = MyMenuData#.IconIndex&
ItemText$ = MyMenuData#.MenuText$
MenuFont& = MyMenuData#.MenuFont&
Long Rect#,0 = Long(lpdis#,28)
Long Rect#,4 = Long(lpdis#,32)
Long Rect#,8 = Long(lpdis#,36)
Long Rect#,12 = Long(lpdis#,40)
Long GRect#,0 = Long(lpdis#,28)
Long GRect#,4 = Long(lpdis#,32)
Long GRect#,8 = Long(lpdis#,36) - Long(Rect#,8) + 25
Long GRect#,12 = Long(lpdis#,40)
Long TRect#,0 = Long(lpdis#,28) + wCheckX& + 8
Long TRect#,4 = Long(lpdis#,32) + 4
Long TRect#,8 = Long(lpdis#,36) - 1
Long TRect#,12 = Long(lpdis#,40)
~FillRect(lpdis#.HDC&,GRect#,~CreateSolidBrush(Color_IconBack&))
If XMBrush&
~SelectObject(lpdis#.HDC&,XMBrush&)
~PatBlt(lpdis#.hdc&,nImageWidth& + 12,Long(lpdis#,32),Long(lpdis#,36),Long(lpdis#,40) - Long(lpdis#,32),~PATCOPY)
EndIf
If MyMenuData#.fType& = ~MFT_SEPARATOR
MenuPen& = ~CreatePen(~PS_SOLID,1,Color_Line&)
OldMenuPen& = ~SelectObject(lpdis#.HDC&,MenuPen&)
~MoveToEx(lpdis#.HDC&,Long(TRect#,0),Long(TRect#,4),0)
~LineTo(lpdis#.HDC&,Long(TRect#,8),Long(TRect#,4))
~SelectObject(lpdis#.HDC&,OldMenuPen&)
EndIf
If Long(lParam&,16) & ~ODS_GRAYED
~ImageList_Draw(hImagelist2&,MenuIcon&,lpdis#.HDC&,Long(lpdis#,28)+4,Long(lpdis#,32)+4,~ILD_TRANSPARENT)
~SetTextColor(lpdis#.HDC&,~GetSysColor(~COLOR_GRAYTEXT))
Else
If Long(lParam&,16) & ~ODS_SELECTED
~FillRect(lpdis#.HDC&,Rect#,~CreateSolidBrush(Color_Selected&))
~FrameRect(lpdis#.HDC&,Rect#,~CreateSolidBrush(Color_FrameRect&))
~SetBkColor(lpdis#.HDC&,RGB(128,128,255))
~ImageList_Draw(hImagelist&,MenuIcon&,lpdis#.HDC&,Long(lpdis#,28)+4,Long(lpdis#,32)+4,~ILD_TRANSPARENT)
Else
If XMBrush&
~SelectObject(lpdis#.HDC&,XMBrush&)
~PatBlt(lpdis#.hdc&,nImageWidth& + 12,Long(lpdis#,32),Long(lpdis#,36),Long(lpdis#,40) - Long(lpdis#,32),~PATCOPY)
Else
~FillRect(lpdis#.HDC&,Rect#,~GetSysColorBrush(~COLOR_MENU))
~FillRect(lpdis#.HDC&,GRect#,~CreateSolidBrush(Color_IconBack&))
EndIf
~ImageList_Draw(hImagelist&,MenuIcon&,lpdis#.HDC&,Long(lpdis#,28)+4,Long(lpdis#,32)+4,~ILD_TRANSPARENT)
EndIf
EndIf
If Long(lParam&,16) & ~ODS_DISABLED
~ImageList_Draw(hImagelist2&,MenuIcon&,lpdis#.HDC&,Long(lpdis#,28)+4,Long(lpdis#,32)+4,~ILD_TRANSPARENT)
~SetTextColor(lpdis#.HDC&,~GetSysColor(~COLOR_GRAYTEXT))
Else
~ImageList_Draw(hImagelist&,MenuIcon&,lpdis#.HDC&,Long(lpdis#,28)+4,Long(lpdis#,32)+4,~ILD_TRANSPARENT)
~SetTextColor(lpdis#.HDC&,~GetSysColor(~COLOR_MENUTEXT))
EndIf
If Long(lParam&,16) & ~ODS_CHECKED
~ImageList_Draw(hImagelist&,CheckedImage&,lpdis#.HDC&,Long(lpdis#,28)+4,Long(lpdis#,32)+4,~ILD_TRANSPARENT)
EndIf
hOldFont& = ~SelectObject(lpdis#.HDC&,MenuFont&)
~SetBkMode(lpdis#.HDC&,~TRANSPARENT)
IfNot MyMenuData#.fType& = ~MFT_SEPARATOR
LeftItext$ = Substr$(Itemtext$,1," ") + " "
RightItext$ = Trim$(Substr$(Itemtext$,2," ")) + " "
~DrawText(lpdis#.HDC&,Addr(LeftItext$),Len(LeftItext$),TRect#,~DT_LEFT)
IfNot RightItext$ = " "
~DrawText(lpdis#.HDC&,Addr(RightItext$),Len(RightItext$),TRect#,~DT_RIGHT)
EndIf
~SelectObject(lpdis#.HDC&,hOldFont&)
EndIf
EndIf
EndProc
Proc CreateImageList
Parameters IconFile$
IconFile$ = Upper$(IconFile$)
hDll& = UseDll(IconFile$)
Iccnt% = IconCount(IconFile$) + 1
hImagelist& = ~ImageList_Create(16,16,~ILC_COLOR32 | ~ILC_MASK,500,500)
hImagelist2& = ~ImageList_Create(16,16,~ILC_COLOR32 | ~ILC_MASK,500,500)
Clear Iczz%
WhileNot Iczz% = Iccnt%
IconName$ = "#" + Trim$(Str$(Iczz%))
hIcon& = ~LoadIcon(hDll&,Addr(IconName$))
~ImageList_AddIcon(hImagelist&,hIcon&)
CreateGrayscaleIcon hIcon&
hIconGray& = @&(0)
~ImageList_AddIcon(hImagelist2&,hIconGray&)
Inc Iczz%
Wend
FreeDLL hDll&
EndProc
Proc ChangeMenuItem
Parameters hMenu&, pMenu&, Index&, Font&
with MenuItemInfo#
.cbSize& = SizeOf(MenuItemInfo#)
.fMask& = ~MIIM_DATA | ~MIIM_TYPE | ~MIIM_ID
.dwTypeData& = MenuText#
.cch& = SizeOf(MenuText#)
endwith
~GetMenuItemInfo(hMenu&,pMenu&,~MF_BYPOSITION,MenuItemInfo#)
with MenuData#[Menu%]
.MenuText$ = String$(MenuText#,0)
.IconIndex& = Index&
.MenuPopUp& = ~GetSubMenu(hMenu&,pMenu&)
.MenuFont& = Font&
.fType& = MenuItemInfo#.fType&
endwith
If MenuItemInfo#.fType& = ~MFT_SEPARATOR
with MenuItemInfo#
.fType& = ~MFT_OWNERDRAW
.fMask& = ~MIIM_DATA | ~MIIM_TYPE
.dwItemData& = MenuData#[Menu%]
endwith
~SetMenuItemInfo(hMenu&,pMenu&,~MF_BYPOSITION,MenuItemInfo#)
Else
with MenuItemInfo#
.fType& = ~MFT_OWNERDRAW
.fMask& = ~MIIM_DATA | ~MIIM_TYPE
.dwItemData& = MenuData#[Menu%]
.dwTypeData& = MenuText#
endwith
~SetMenuItemInfo(hMenu&,pMenu&,~MF_BYPOSITION,MenuItemInfo#)
EndIf
Inc Menu%
EndProc
Proc SetCheckedImage
Parameters Checked&
CheckedImage& = Checked&
EndProc
Proc SetMenuColors
Parameters IconBackColor&, LineColor&, SelectedColor&, FrameRectColor&
Color_IconBack& = IconBackColor&
Color_Line& = LineColor&
Color_Selected& = SelectedColor&
Color_FrameRect& = FrameRectColor&
EndProc
Proc SetMenuStandardColors
Color_IconBack& = RGB(212,208,200)
Color_Line& = RGB(212,208,200)
Color_Selected& = RGB(128,128,255)
Color_FrameRect& = RGB(0,0,255)
EndProc
Proc SetMenuBitmap
Parameters BitmapFile$, Bitmap$
hBitmapDll& = UseDll(BitmapFile$)
If Bitmap$ <> ""
Case XMbgBmp& : ~DeleteObject(XMbgBmp&)
Case XMBrush& : ~DeleteObject(XMBrush&)
XMbgBMP& = Create("hPic",hBitmapDll&,Bitmap$)
XMBrush& = ~CreatePatternBrush(XMbgBmp&)
FreeDLL hBitmapDll&
EndIf
EndProc
Proc DisposeXPMenu
Dispose MenuItemInfo#
Dispose MenuText#
Dispose MenuData#[]
Dispose MyMenuData#
Dispose lpdis#
Dispose lpmis#
Dispose Rect#
Dispose GRect#
Dispose TRect#
Dispose Size#
~ImageList_Destroy(hImagelist&)
~ImageList_Destroy(hImagelist2&)
~DeleteDC(MenuDC&)
~DeleteObject(MenuPen&)
~DeleteObject(OldMenuPen&)
ENDPROC
|
| | | XProfan X4, PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11 | 24.08.2005 ▲ |
| |
| | | Lol - maintenant hat es Klick chez mir gemacht.
je sais zwar wonach tu cherches - Du vouloir so comment je es verstanden habe Dein ODMenü comme _default mettons - quasi une Handletausch durchführen - si ca so gedacht ist sais je malheureusement pas , mais...
normalement sollte on oui cela menu refreshen après que qui Message ankommt - nutze doch simple cet Message comme Indikator pour cela Du cela menu selbst austauscht... |
| | | | |
| | Detlef Jagolski | Salut,
habe encore aucun Solution, brauche encore une Tipp.
Gute nuit |
| | | XProfan X4, PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11 | 25.08.2005 ▲ |
| |
|
répondreOptions du sujet | 1.188 Views |
Themeninformationencet Thema hat 2 participant: |