Bonjour,
J'ai 2 questions à poser:
1) SetGadgetColor s'applique sur plusieurs gadgets mais pas sur Frame3DGadget. Y a t il un autre moyen de colorer ce gadget (en texte et fond)? Si oui comment?
2) OpenWindow() ouvre toujours une fenêtre classique ayant la forme et la couleur selon le windows installé. Je voudrais savoir comment créer une fenêtre tout à fait spécifique qui ne ressemble pas du tout au classique (genre fenêtre avast par exemple).
Merci encore de votre aide
Anissa
Couleur sur Frame3DGadget
-
- Messages : 604
- Inscription : lun. 26/avr./2010 16:14
- Localisation : S 48° 52' 31'' / O 123° 23' 33''
Re: Couleur sur Frame3DGadget
Bonjour
Le bouton Rechercher est ton ami !!! N'hésite pas à t'appuyer sur lui...
1) http://www.purebasic.fr/french/viewtopi ... et#p107456
2) http://www.purebasic.fr/french/viewtopi ... skinwindow
Le bouton Rechercher est ton ami !!! N'hésite pas à t'appuyer sur lui...
1) http://www.purebasic.fr/french/viewtopi ... et#p107456
2) http://www.purebasic.fr/french/viewtopi ... skinwindow
Re: Couleur sur Frame3DGadget
salut anissa
voici une solution. Elle est de Fluid Byte, un peu modifiée.
Pour que ce soit ok, les themes xp ont été enlevés sur les Frames. Par contre sur le bouton le thème XP existe
(Annoter que le bouton ne sert a rien que pour l'exemple des thèmes.)
voici une solution. Elle est de Fluid Byte, un peu modifiée.
Code : Tout sélectionner
; Title: Frame3DGadgetEx
; Author: Fluid Byte
; Date: December 31, 2006
; Version: PureBasic V4.3
Global FontID3
FontID3 = LoadFont(3, "Courier New", 12)
Structure FRAME3DEX
lpPrevFunc.l
clrText.l
EndStructure
Procedure Frame3DExProc(hWnd.l,uMsg.l,wParam.l,lParam.l)
Protected hDC.l,ps.PAINTSTRUCT,*frmex.FRAME3DEX,Title.s,fts.SIZE,wrc.RECT,lpBuffer.l,hThemeButton.l
*frmex = GetWindowLong_(hwnd,#GWL_USERDATA)
Select uMsg
Case #WM_DESTROY
*frmex\lpPrevFunc = -1
ProcedureReturn 0
Case #WM_PAINT
hdc = BeginPaint_(hwnd,ps)
;SelectObject_(hdc,SendMessage_(hwnd,#WM_GETFONT,0,0)) ;on peu changer de fonte
SelectObject_(hdc,SendMessage_(hwnd,FontID3,0,0)) ; comme ici
Title = GetGadgetText(GetDlgCtrlID_(hwnd))
GetTextExtentPoint32_(hdc,Title,Len(Title),fts)
GetClientRect_(hWnd,wrc)
SetRect_(wrc,wrc\left,wrc\top+fts\cy/2,wrc\right,wrc\bottom)
DrawEdge_(hdc,wrc,#EDGE_ETCHED,#BF_RECT)
SetBkColor_(hdc,GetSysColor_(#COLOR_3DFACE)) ;couleur de fond sous le texte
SetTextColor_(hdc,*frmex\clrText)
TextOut_(hdc,9,0,Title,Len(Title)) ; placement du texte
EndPaint_(hwnd,ps)
ProcedureReturn 0
Default
If *frmex\lpPrevFunc = -1 : FreeMemory(*frmex) : Else
ProcedureReturn CallWindowProc_(*frmex\lpPrevFunc,hWnd,uMsg,wParam,lParam)
EndIf
EndSelect
EndProcedure
Procedure Frame3DGadgetEx(GadgetID.w,X.w,Y.w,Width.w,Height.w,Text.s,Color.l=0)
Protected *frmex.FRAME3DEX,HINSTANCE.l
Frame3DGadget(GadgetID,X,Y,Width,Height,Text)
*frmex = AllocateMemory(SizeOf(FRAME3DEX))
*frmex\lpPrevFunc = SetWindowLong_(GadgetID(GadgetID),#GWL_WNDPROC,@Frame3DExProc())
*frmex\clrText = Color
SetWindowLong_(GadgetID(GadgetID),#GWL_USERDATA,*frmex)
ProcedureReturn GadgetID(GadgetID)
EndProcedure
OpenWindow(0,0,0,400,300,"Ownerdraw Frame3D Control",#WS_OVERLAPPEDWINDOW | 1)
SetGadgetFont(#PB_Default,LoadFont(0,"Arial",9))
Frame3DGadgetEx(101,10,5,200,90,"Sans theme XP",#Red)
Frame3DGadgetEx(102,10,100,200,90,"Sans theme XP",RGB(40,180,70))
Frame3DGadgetEx(103,10,195,200,90,"Sans theme XP",#Blue)
ButtonGadget(1, 300, 240, 80, 50, "Theme XP")
While WaitWindowEvent() ! 16 : Wend
(Annoter que le bouton ne sert a rien que pour l'exemple des thèmes.)