
Style Windows Media Player 10
Style Windows Media Player 10
Est il possible de modifier l'apparence complete des Boîtes à onglets (Panel) (pas seulement l'image), un peu comme Windows Media Player 10


Tu peux toujours essayer avec skinwin, ça fonctionne, (un peu), mais bon... c'est pas ça quand même!
Code : Tout sélectionner
Image1 = CreateImage(0,306,203)
If Image1
StartDrawing(ImageOutput())
Box(0,0,306,203,RGB($0,$0,$FF))
StopDrawing()
EndIf
Image2 = CreateImage(1,322,220)
If Image2
StartDrawing(ImageOutput())
Box(0,0,322,220,RGB($FF,$0,$0))
StopDrawing()
EndIf
If OpenWindow(0,0,0,322,220,#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_Invisible,"PanelGadget")
If CreateGadgetList(WindowID(0))
PanelGadget (0,8,8,306,203)
AddGadgetItem (0,-1,"Panel 1")
AddGadgetItem (0,-1,"Panel 2")
ButtonGadget(2, 10, 15, 80, 24,"Button 1")
ButtonGadget(3, 95, 15, 80, 24,"Button 2")
CloseGadgetList()
EndIf
SkinWin(WindowID(),Image2)
SkinWin(GadgetID(0),Image1)
HideWindow(0, 0)
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
c'est pas vraiment ça, je l'ai corrigé pour la nouvelle version de pb
Code : Tout sélectionner
#ODS_SELECTED=1
#ODS_GRAYED=2
#ODS_DISABLED=4
#ODS_CHECKED=8
#ODS_FOCUS=16
#ODS_DEFAULT= 32
#ODS_COMBOBOXEDIT= 4096
#ODT_STATIC = 5
#SS_OWNERDRAW=13
;This are needed for PB's drawing functions to work.
Structure PBDrawingStruct
Type.l
WindowHandle.l
DC.l
ReleaseProcedure.l
EndStructure
mydraw.PBDrawingStruct
mydraw\Type=1
Global mydraw
;listicon stuff
#LVM_GETSUBITEMRECT=4152
#LVM_SUBITEMHITTEST=4153
#NM_CUSTOMDRAW = #NM_FIRST - 12
#CDDS_ITEM = $10000
#CDDS_SUBITEM = $20000
#CDDS_PREPAINT = $1
#CDDS_ITEMPREPAINT = #CDDS_ITEM | #CDDS_PREPAINT
#CDDS_SUBITEMPREPAINT = #CDDS_SUBITEM | #CDDS_ITEMPREPAINT
#CDRF_DODEFAULT = $0
#CDRF_NEWFONT = $2
#CDRF_NOTIFYITEMDRAW = $20
#CDRF_NOTIFYSUBITEMDRAW = $20
#CDRF_SKIPDEFAULT=4
#panel =0
#od_panel =1
#listicon =2
#combo =3
#listview =4
#buttonimage=5
#button =6
#text =7
Procedure Open_mainwindow()
If OpenWindow(0, 222, 49, 400, 400, #PB_Window_SystemMenu | #PB_Window_TitleBar , "OwnerDrawing ")
If CreateGadgetList(WindowID())
PanelGadget(#panel,0,0,400,400)
AddGadgetItem(#panel,0,"ListIconGadget")
ListIconGadget(#listicon,5,5,385,370,"List",50);LBS_OWNERDRAWFIXED)
AddGadgetColumn(#listicon,1,"Icon",50)
AddGadgetColumn(#listicon,2,"Gadget",50)
AddGadgetItem(#listicon,0,Str(RGB(0,0,0))+Chr(10)+Str(RGB(100,100,100))+Chr(10)+Str(RGB(0,0,0)))
AddGadgetItem(#listicon,1,Str(RGB(255,0,0))+Chr(10)+Str(RGB(0,255,255))+Chr(10)+Str(RGB(25,25,25)))
AddGadgetItem(#listicon,2,Str(RGB(0,255,0))+Chr(10)+Str(RGB(255,255,0))+Chr(10)+Str(RGB(50,50,50)))
AddGadgetItem(#listicon,3,Str(RGB(0,0,255))+Chr(10)+Str(RGB(255,0,255))+Chr(10)+Str(RGB(75,75,75)))
AddGadgetItem(#listicon,4,Str(RGB(255,0,255))+Chr(10)+Str(RGB(0,0,255))+Chr(10)+Str(RGB(100,100,100)))
AddGadgetItem(#listicon,5,Str(RGB(255,255,0))+Chr(10)+Str(RGB(0,255,0))+Chr(10)+Str(RGB(150,150,150)))
AddGadgetItem(#listicon,6,Str(RGB(0,255,255))+Chr(10)+Str(RGB(255,0,0))+Chr(10)+Str(RGB(200,200,200)))
AddGadgetItem(#listicon,7,Str(RGB(100,100,100))+Chr(10)+Str(RGB(0,0,0))+Chr(10)+Str(RGB(255,255,255)))
AddGadgetItem(#panel,1,"Listview")
ListViewGadget(#listview,5,5,385,370,#LBS_OWNERDRAWFIXED)
AddGadgetItem(#listview,0,Str(RGB(0,0,0)))
AddGadgetItem(#listview,1,Str(RGB(255,0,0)))
AddGadgetItem(#listview,2,Str(RGB(0,255,0)))
AddGadgetItem(#listview,3,Str(RGB(0,0,255)))
AddGadgetItem(#listview,4,Str(RGB(255,0,255)))
AddGadgetItem(#listview,5,Str(RGB(255,255,0)))
AddGadgetItem(#listview,6,Str(RGB(0,255,255)))
AddGadgetItem(#listview,7,Str(RGB(100,100,100)))
AddGadgetItem(#panel,2,"PanelGadget")
PanelGadget(#od_panel,5,5,385,370)
old_style=GetWindowLong_(GadgetID(#od_panel),#GWL_STYLE)
SetWindowLong_(GadgetID(#od_panel),#GWL_STYLE,old_style | #TCS_OWNERDRAWFIXED)
AddGadgetItem(#od_panel,0,"Panel 1")
AddGadgetItem(#od_panel,1,"Panel 2")
AddGadgetItem(#od_panel,2,"Panel 3")
AddGadgetItem(#panel,3,"ComboGadget & Others")
ComboBoxGadget(#combo,5,5,385,100,#CBS_OWNERDRAWFIXED)
AddGadgetItem(#combo,0,Str(RGB(0,0,0)))
AddGadgetItem(#combo,1,Str(RGB(255,0,0)))
AddGadgetItem(#combo,2,Str(RGB(0,255,0)))
AddGadgetItem(#combo,3,Str(RGB(0,0,255)))
AddGadgetItem(#combo,4,Str(RGB(255,0,255)))
AddGadgetItem(#combo,5,Str(RGB(255,255,0)))
AddGadgetItem(#combo,6,Str(RGB(0,255,255)))
AddGadgetItem(#combo,7,Str(RGB(100,100,100)))
ButtonGadget(#button,5,35, 190,200,"TEST",#BS_OWNERDRAW)
TextGadget(#text,200,35,190,200,"TEST",#PB_Text_Border|#SS_OWNERDRAW)
EndIf
EndIf
EndProcedure
Open_mainwindow()
Procedure.l callback(WindowID, Message, wParam, lParam)
mygadget.PBDrawingstruct
Result = #PB_ProcessPureBasicEvents
Select Message
;listicongadget
Case #WM_NOTIFY
*ptr.NMLVCUSTOMDRAW=lparam
If lparam
Select *ptr\nmcd\hdr\code
Case #NM_CUSTOMDRAW
Select *ptr\nmcd\dwDrawStage
Case #CDDS_PREPAINT
result=#CDRF_NOTIFYITEMDRAW
Case #CDDS_ITEMPREPAINT
result=#CDRF_NOTIFYSUBITEMDRAW
Case #CDDS_SUBITEMPREPAINT
Row.l = *ptr\nmcd\dwItemSpec
Col.l = *ptr\iSubItem
rc.RECT:rc\left=#LVIR_BOUNDS:rc\top=col:SendMessage_(*ptr\nmcd\hdr\hwndfrom,#LVM_GETSUBITEMRECT,*ptr\nmcd\dwItemSpec,@rc)
x=rc\left
y=rc\top
w=rc\right-rc\left
h=rc\bottom-rc\top
mydraw\WindowHandle=*ptr\nmcd\hdr\hwndfrom
mydraw\type=1
color=Val(GetGadgetItemText(#listicon,row,col))
StartDrawing(mydraw)
DrawingMode(0):Box(x,y,w,h,color)
StopDrawing()
result=#CDRF_SKIPDEFAULT
EndSelect
EndSelect
EndIf
Case #WM_MEASUREITEM
Debug hmenu
Debug wparam
result=#TRUE
Case #WM_DRAWITEM
*lpdis.DRAWITEMSTRUCT=lparam
x=*lpdis\rcItem\left
y=*lpdis\rcItem\top
w=*lpdis\rcItem\right-*lpdis\rcItem\left
h=*lpdis\rcItem\bottom-*lpdis\rcItem\top
Select *lpdis\CtlType
Case #ODT_STATIC
mydraw\WindowHandle=*lpdis\hwndItem
StartDrawing(mydraw)
DrawingMode(0):Box(x,y,w,h,RGB(Random(255),Random(255),Random(255)))
Locate(10,h/2)
DrawText("Ownerdraw Textgadget")
StopDrawing()
result=#TRUE
;PanelGadget
Case #ODT_TAB
If *lpdis\hwndItem=GadgetID(#od_panel)
mydraw\WindowHandle=*lpdis\hwndItem
StartDrawing(mydraw)
DrawingMode(0):Box(x+2,y+2,w-4,h-4,RGB(Random(255),Random(255),Random(255)))
StopDrawing()
result=#TRUE
EndIf
;buttongadget
Case #ODT_BUTTON
mydraw\WindowHandle=*lpdis\hwndItem
StartDrawing(mydraw)
DrawingMode(0):Box(x,y,w,h,RGB(Random(255),Random(255),Random(255)))
Locate(10,h/2)
DrawText("Ownerdraw Button")
StopDrawing()
result=#TRUE
;listviewgadget
Case #ODT_LISTBOX
buffer.s=Space(255):SendMessage_(GadgetID(#listview),#LB_GETTEXT,*lpdis\itemID,@buffer):col=Val(buffer)
mydraw\WindowHandle=*lpdis\hwndItem
StartDrawing(mydraw)
Select *lpdis\itemaction
Case #ODA_SELECT
Box(x,y,w,h,col)
Case #ODA_FOCUS
DrawingMode(2 | 4):Box(x+1,y+1,w-1,h-1,0):DrawingMode(0)
Case #ODA_DRAWENTIRE
Box(x,y,w,h,col)
EndSelect
StopDrawing()
result=#TRUE
;combogadget
Case #ODT_COMBOBOX
Select *lpdis\hwndItem
Case GadgetID(#combo)
mydraw\WindowHandle=WindowFromDC_(*lpdis\hdc)
If *lpdis\itemID=-1
Else
buffer=Space(255):SendMessage_(GadgetID(#combo),#CB_GETLBTEXT,*lpdis\itemID,@buffer)
col=Val(buffer)
StartDrawing(mydraw)
Select *lpdis\itemaction
Case #ODA_SELECT
Box(x,y,w,h,col)
Case #ODA_FOCUS
DrawingMode(2 | 4):Box(x+1,y+1,w-1,h-1,0):DrawingMode(0)
Case #ODA_DRAWENTIRE
Box(x,y,w,h,col)
EndSelect
StopDrawing()
result=#TRUE
EndIf
EndSelect
EndSelect
EndSelect
ProcedureReturn result
EndProcedure
SetWindowCallback(@callback())
Repeat
Event = WaitWindowEvent()
Until Event = #PB_EventCloseWindow
End
-
- Messages : 4312
- Inscription : mer. 28/janv./2004 20:58
- Localisation : Clermont ferrand OU Olsztyn
- Contact :