
ImageGadget ohne Border z.B. für die schönen Buttons?
Der Rest sicher 2D-Zeichnen oder?
Code: Alles auswählen
Macro Happy
;-)
EndMacro
Happy End
Code: Alles auswählen
Procedure WindowCallback(hwnd,msg,wParam,lParam)
Protected old.l
Protected *item.DRAWITEMSTRUCT
Protected point.POINT , oldpoint.POINT
old = GetProp_(hwnd,"PROP_OLDPROC")
Select msg
Case #WM_DRAWITEM
*item = lParam
DC = *item\hdc
w = *item\rcItem\right - *item\rcItem\left
h = *item\rcItem\bottom - *item\rcItem\top
MapWindowPoints_(GetParent_(hwnd),hwnd,@point,1)
BackBrush = GetClassLong_(hwnd, #GCL_HBRBACKGROUND)
SetBrushOrgEx_(DC,point\x,point\y,@oldpoint)
FillRect_(DC,*item\rcItem,BackBrush)
SetBrushOrgEx_(DC,oldpoint\x,oldpoint\y,0)
If *item\itemState & #ODS_SELECTED
hpen = CreatePen_(#PS_SOLID,1,$849584)
hbrush = CreateSolidBrush_($BCC5BC)
*item\rcItem\bottom + 2
Else
hbrush = CreateSolidBrush_($BCC5BC)
EndIf
If *item\itemState & #ODS_DISABLED
SetTextColor_(DC,$666666)
hpen = CreatePen_(#PS_SOLID,1,$849584)
EndIf
SelectObject_(DC,hpen)
SelectObject_(DC,hbrush)
Ellipse_(DC,0,0,w,h)
DeleteObject_(hpen)
DeleteObject_(hbrush)
SetBkMode_(DC,#TRANSPARENT)
DrawText_(DC, GetGadgetText(*item\CtlID), Len(GetGadgetText(*item\CtlID)), *item\rcItem, #DT_CENTER | #DT_SINGLELINE | #DT_VCENTER | #DT_NOCLIP)
ProcedureReturn #True
Case #WM_DESTROY
RemoveProp_(hwnd,"PROP_OLDPROC")
EndSelect
ProcedureReturn CallWindowProc_(old,hwnd,msg,wParam,lParam)
EndProcedure
Procedure RoundButton(id,x,y,cx,cy,text.s,flags)
Protected temp.l
Static old.l
temp = ButtonGadget(id,x,y,cx,cy,text,flags|#BS_OWNERDRAW)
If id = #PB_Any
hwnd = GadgetID(temp)
Else
hwnd = temp
EndIf
If old = 0
old = SetWindowLong_(GetParent_(hwnd),#GWL_WNDPROC,@WindowCallback())
SetProp_(GetParent_(hwnd),"PROP_OLDPROC",old)
EndIf
ProcedureReturn temp
EndProcedure
*win.LONG = OpenWindow(#PB_Any,0,0,200,200,$C80001,"")
CreateGadgetList(*win\l)
rb0 = RoundButton(#PB_Any,10,10,50,50,"blub",flags) : DisableGadget(rb0,1)
rb1 = RoundButton(#PB_Any,60,60,50,50,"blub",flags)
rb2 = RoundButton(#PB_Any,10,90,50,50,"blub",flags)
Repeat
e = WaitWindowEvent()
If e = #PB_Event_Gadget
Select EventGadgetID()
Case rb0 : Debug "Press rb0"
Case rb1 : Debug "Press rb1"
Case rb2 : Debug "Press rb2"
EndSelect
ElseIf e = #PB_Event_CloseWindow
Break
EndIf
ForEver
End