ah oui.... je me souvenais plus de cela merci.
Code : Tout sélectionner
; #####################################################
; kernadec en janvier 2010 PB441(DrawRotatedText)##
; sur l'idée de fleche du projet KCC ##
; flèche avec fontes zoom molette ##
; deplacement clic gauche, rotation clic droit ##
; #####################################################
#WM_MOUSEWHEEL = $20A
Enumeration
#Fenetre
#Image_0
#Image_1
#Image_2
#StringGadget_1
#ImageGadget
#ImageGadget_2
#boutonGadget_0
#boutonGadget_1
#boutonGadget_2
#boutonGadget_3
#boutonGadget_4
EndEnumeration
Structure tx
x0.l:y0.l:taille.d:ft.l:Angle.l
EndStructure
Global Dim pos.tx(4)
Global dc.l,epais.l,fleche.l,px.l,bm.l,fl.l,fonte$
winl.l=800
winh.l=600
Posx.l=0
Posy.l=0
Posl.l=300
Posh.l=300
epais=5
Px=30
fonte$="arial";"fleche";arial fleche
Procedure.w MouseWheelDelta()
z.w=((EventwParam()>>16)&$FFFF)
ProcedureReturn -(z/100)
EndProcedure
Procedure Ligne(x,y,x1,y1,Width,color)
pen=CreatePen_(#PS_SOLID,Width,color)
penOld=SelectObject_(DC,pen)
MoveToEx_(DC,x,y,0):LineTo_(DC,x1,y1)
DeleteObject_(pen)
DeleteObject_(penOld)
EndProcedure
Procedure dessin(Posx,Posy,Posl,Posh)
Static MemTypeFleche
dc=StartDrawing(ImageOutput(#Image_1))
DrawImage(ImageID(#Image_2),0,0,ImageWidth(#Image_2),ImageHeight(#Image_2))
DrawingMode(1)
DrawingFont(FontID(0))
DrawRotatedText(Pos(0)\x0,Pos(0)\y0,"BOUTON 0",Pos(0)\Angle,RGB(0,0,255))
DrawingFont(FontID(1))
DrawRotatedText(Pos(1)\x0,Pos(1)\y0,"BOUTON 1",Pos(1)\Angle,RGB(100,200,100))
DrawingFont(FontID(2))
DrawRotatedText(Pos(2)\x0,Pos(2)\y0,"BOUTON 2",Pos(2)\Angle,RGB(255,0,255))
DrawingFont(FontID(3))
DrawRotatedText(Pos(3)\x0,Pos(3)\y0,"BOUTON 3",Pos(3)\Angle,RGB(205,205,0))
StopDrawing()
LoadFont(Pos(fl)\ft,fonte$, Pos(fl)\taille)
DisableGadget(#ImageGadget,1)
SetGadgetState(#ImageGadget,ImageID(#Image_1))
EndProcedure
Pos(0)\ft=0:Pos(0)\x0=10:Pos(0)\y0=10:Pos(0)\taille=40
Pos(1)\ft=1:Pos(1)\x0=10:Pos(1)\y0=10:Pos(1)\taille=60
Pos(2)\ft=2:Pos(2)\x0=10:Pos(2)\y0=10:Pos(2)\taille=80
Pos(3)\ft=3:Pos(3)\x0=10:Pos(3)\y0=10:Pos(3)\taille=100
LoadFont(Pos(0)\ft,fonte$,Pos(0)\taille)
LoadFont(Pos(1)\ft,fonte$,Pos(1)\taille)
LoadFont(Pos(2)\ft,fonte$,Pos(2)\taille)
LoadFont(Pos(3)\ft,fonte$,Pos(3)\taille)
hwnd.l=OpenWindow(#Fenetre, 0, 0,winl,winh, "Fleche fonte",#WS_SYSMENU|#PB_Window_ScreenCentered)
CreateImage(#Image_0,winl,winh)
CreateImage(#Image_1,winl,winh)
CreateImage(#Image_2,winl-6,winh-32)
StartDrawing(ImageOutput(#Image_0))
Box(0,0,winl,winh,RGB(225,225,225))
StopDrawing()
ImageGadget(#ImageGadget,Posx,Posy,200,200,ImageID(#Image_0))
SetGadgetState(#ImageGadget,ImageID(#Image_0))
ButtonGadget(#boutonGadget_0, 120,80, 50, 30, "B0" )
ButtonGadget(#boutonGadget_1, 440,180, 50, 30, "B1" )
ButtonGadget(#boutonGadget_2, 240,390, 50, 30, "B2" )
ButtonGadget(#boutonGadget_3, 620,290, 50, 30, "B3" )
DC=StartDrawing(ImageOutput(#Image_2))
For i=1 To 50:WindowEvent():Next i ; boucle de dessin des boutons sur la fenetre avant screenshot
BitBlt_(DC,0,0,ImageWidth(#Image_2),ImageHeight(#Image_2),GetDC_(hwnd),0,0,#SRCCOPY)
StopDrawing()
dessin(Pos(fl)\x0,Pos(fl)\y0,Posl,Posh)
bm=#False
Repeat
event =WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case #boutonGadget_0
Debug "B0"
fl=0
SetCursorPos_(Pos(0)\x0+WindowX(#Fenetre),Pos(0)\y0+WindowY(#Fenetre))
RedrawWindow_(WindowID(#Fenetre), 0, 0, #RDW_INVALIDATE|#RDW_UPDATENOW)
Case #boutonGadget_1
Debug "B1"
fl=1
SetCursorPos_(Pos(1)\x0+WindowX(#Fenetre),Pos(1)\y0+WindowY(#Fenetre))
RedrawWindow_(WindowID(#Fenetre), 0, 0, #RDW_INVALIDATE|#RDW_UPDATENOW)
Case #boutonGadget_2
Debug "B2"
fl=2
SetCursorPos_(Pos(2)\x0+WindowX(#Fenetre),Pos(2)\y0+WindowY(#Fenetre))
RedrawWindow_(WindowID(#Fenetre), 0, 0, #RDW_INVALIDATE|#RDW_UPDATENOW)
Case #boutonGadget_3
Debug "B3"
fl=3
SetCursorPos_(Pos(3)\x0+WindowX(#Fenetre),Pos(3)\y0+WindowY(#Fenetre))
RedrawWindow_(WindowID(#Fenetre), 0, 0, #RDW_INVALIDATE|#RDW_UPDATENOW)
EndSelect
Case #PB_Event_CloseWindow
Quit = #True
EndSelect
LoadFont(Pos(fl)\ft,fonte$, Pos(fl)\taille)
If event=#WM_MOUSEWHEEL
Pos(fl)\taille=Pos(fl)\taille+MouseWheelDelta()*2
LoadFont(Pos(fl)\ft,fonte$, Pos(fl)\taille)
dessin(Pos(fl)\x0,Pos(fl)\y0,Posl,Posh)
EndIf
If event=#WM_RBUTTONUP
bm=#False
EndIf
If event=#WM_LBUTTONUP
bm=#False
EndIf
If event=#WM_LBUTTONDOWN
bm=#True
Posx1 = WindowMouseX(0)-Posx
Posy1 = WindowMouseY(0)-Posy
EndIf
If event=#WM_RBUTTONDOWN
Pos(fl)\Angle=Pos(fl)\Angle+90
Pos(fl)\Angle=Pos(fl)\Angle%360
dessin(Pos(fl)\x0,Pos(fl)\y0,Posl,Posh)
If Pos(fl)\Angle=90:Pos(fl)\y0=Pos(fl)\y0+Pos(fl)\taille:EndIf
If Pos(fl)\Angle=180:Pos(fl)\x0=Pos(fl)\x0+Pos(fl)\taille:Pos(fl)\y0=Pos(fl)\y0:EndIf
If Pos(fl)\Angle=270:Pos(fl)\x0=Pos(fl)\x0:Pos(fl)\y0=Pos(fl)\y0-Pos(fl)\taille:EndIf
If Pos(fl)\Angle=0:Pos(fl)\x0=Pos(fl)\x0-Pos(fl)\taille:Pos(fl)\y0=Pos(fl)\y0:EndIf
dessin(Pos(fl)\x0,Pos(fl)\y0,Posl,Posh)
Debug Pos(fl)\x0
Debug Pos(fl)\y0
Debug Pos(fl)\Angle
bm=#True
Posl1 = WindowMouseX(0)-Posl
Posh1 = WindowMouseY(0)-Posh
EndIf
If event=#WM_MOUSEMOVE
If bm=#True
If GetAsyncKeyState_(#VK_LBUTTON)
If Pos(fl)\Angle=0:centrex.l=Pos(fl)\taille/2:centrey.l=Pos(fl)\taille/2:EndIf
If Pos(fl)\Angle=90:centrex.l=Pos(fl)\taille/2:centrey.l=-Pos(fl)\taille/2:EndIf
If Pos(fl)\Angle=180:centrex.l=-Pos(fl)\taille/2:centrey.l=-Pos(fl)\taille/2:EndIf
If Pos(fl)\Angle=270:centrex.l=-Pos(fl)\taille/2:centrey.l=Pos(fl)\taille/2:EndIf
Pos(fl)\x0=WindowMouseX(0)-centrex;-Posx1
Pos(fl)\y0=WindowMouseY(0)-centrey;-Posy1
dessin(Pos(fl)\x0,Pos(fl)\y0,Posl,Posh)
EndIf
EndIf
If GetAsyncKeyState_(#VK_RBUTTON)
Posl=WindowMouseX(0)-Posl1
Posh=WindowMouseY(0)-Posh1
; dessin(Posx,Posy,Posl,Posh)
EndIf
EndIf
Until Quit = #True