Seite 3 von 3

Verfasst: 05.02.2008 16:32
von Falko
Du meinst es so herum?

Code: Alles auswählen

;Author: Falko Lünsmann
;API and PB4: Draws simple Text on circle
; changed for PB4: ts-soft

Procedure DrawRText(DC.l,x,y,Text.s,fFont.s,fangle.l,fHeight)
  Font = CreateFont_(fHeight,0,fangle*10,0,0,0,0,0,0,0,0,0,0,fFont)
  GetWindowRect_(WindowID(0),r.RECT)
  OldFont = SelectObject_(DC,Font)
  SetTextAlign_(DC,#TA_BASELINE   )
  SetBkMode_(DC,#TRANSPARENT)
  ExtTextOut_(DC, x,y,0 ,r,Text,Len(Text),0 )
  SelectObject_(DC,OldFont)
  DeleteObject_(Font)
EndProcedure

 OpenWindow(0, 0, 0, 400, 400, "Arc and bezier curves", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
 
 Procedure Circle_Text(String$)
  hDc=StartDrawing(WindowOutput(0))
  If hDc
      FrontColor(RGB(0,255,0))
      Radius=180
      String$="Purebasic 4 you"
 
      For i=1 To Len(string$)
         Zeichen$=Mid(String$,i,1)
         Winkel=-20 * i
         X = Radius*Sin(Winkel/360*2*#PI)
         Y = Radius*Cos(Winkel/360*2*#PI)
         DrawRText(hDc,WindowWidth(0)/2-X,WindowHeight(0)/2-Y,Zeichen$,"Arial",Winkel,40)
      Next i
   StopDrawing()
   EndIf
  EndProcedure
 Circle_Text("Happy Purebasic4")
 Repeat
  Event=WaitWindowEvent()
  If Event=#PB_Event_MoveWindow : Circle_Text("Happy Purebasic4") : EndIf ;  Redraw Windows!
 Until Event = #PB_Event_CloseWindow
Gruß Falko

Verfasst: 05.02.2008 18:20
von roherter
Ja genau so danke! :D

Verfasst: 05.02.2008 18:34
von Christian H
Falko hat geschrieben:

Code: Alles auswählen

  If Event=#PB_Event_MoveWindow : Circle_Text("Happy Purebasic4") : EndIf ;  Redraw Windows!
Eine kleine Schönheitskorrektur

Code: Alles auswählen

If Event=#PB_Event_Repaint : Circle_Text("Happy Purebasic4") : EndIf ;  Redraw Windows!
Gruß Christian

Verfasst: 05.02.2008 22:23
von roherter
Christian H
Eine kleine Schönheitskorrektur

Code:
If Event=#PB_Event_Repaint : Circle_Text("Happy Purebasic4") : EndIf ; Redraw Windows!
Darum ging es gar nicht der code funktioniert. :?