DrawText(Texte$) Vertical

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
julien
Messages : 846
Inscription : ven. 30/janv./2004 15:06
Contact :

DrawText(Texte$) Vertical

Message par julien »

Ehuu comment on fait ?
Est ce qu'il ya une commande ou il faut la faire soi même ?
fweil
Messages : 505
Inscription : dim. 16/mai/2004 17:50
Localisation : Bayonne (64)
Contact :

Message par fweil »

Par l'API et par exemple, à partir de mes templates :

Code : Tout sélectionner

Enumeration
  #Window_Main
EndEnumeration

#AW_HOR_POSITIVE = $1 ; Animates the window from left to right. This flag can be used with roll or slide animation.
#AW_HOR_NEGATIVE = $2 ; Animates the window from right to left. This flag can be used with roll or slide animation.
#AW_VER_POSITIVE = $4 ; Animates the window from top to bottom. This flag can be used with roll or slide animation.
#AW_VER_NEGATIVE = $8 ; Animates the window from bottom to top. This flag can be used with roll or slide animation.
#AW_CENTER = $10 ; Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used.
#AW_HIDE = $10000 ; Hides the window. By default, the window is shown.
#AW_ACTIVATE = $20000 ; Activates the window.
#AW_SLIDE = $40000 ; Uses slide animation. By default, roll animation is used.
#AW_BLEND = $80000 ; Uses a fade effect. This flag can be used only if hwnd is a top-level window.

Procedure DrawRotatedText(Image.l, Text.s, x.l, y.l, FontName.s, Size.l, Angle.l, Weight.l, Italic.l, Underline.l, StrikeOut.l, BackgroundColor.l, ForegroundColor.l, DrawingMode.l)
  UseImage(Image)
  ImageDC.l = StartDrawing(ImageOutput())
    hFont.l = CreateFont_(Size * GetDeviceCaps_(ImageDC, #LOGPIXELSY) / 72, 0, Angle * 10, 0, Weight, Italic, Underline, StrikeOut, #ANSI_CHARSET, #OUT_TT_PRECIS, #CLIP_LH_ANGLES, #PROOF_QUALITY, #DEFAULT_PITCH |#FF_DONTCARE, FontName)
    PreviousFont.l = SelectObject_(ImageDC, hFont)
    Locate(x, y)
    DrawingMode(DrawingMode)
    BackColor(Red(BackgroundColor), Green(BackgroundColor), Blue(BackgroundColor))
    FrontColor(Red(ForegroundColor), Green(ForegroundColor), Blue(ForegroundColor))
    DrawText(Text)
  StopDrawing()
  SelectObject_(ImageDC, PreviousFont)
  DeleteObject_(hFont)
EndProcedure

Procedure DrawBackgroundImage(ImageWidth, ImageHeight, Text.s, BackgroundColor.l, TextColor.l, Spacing.l)
Static ImageNumber
  If ImageNumber
      FreeImage(ImageNumber)
  EndIf
  ImageNumber = CreateImage(#PB_Any, ImageWidth, ImageHeight)
  ImageID = UseImage(ImageNumber)
  StartDrawing(ImageOutput())
    Box(0, 0, ImageWidth, ImageHeight, BackgroundColor)
  StopDrawing()
  For x = 0 To ImageWidth
    For y = 0 To ImageHeight
      DrawRotatedText(ImageNumber, Text, x, y, "Verdana", 12, 90, 100, #False, #False, #False, #Black, TextColor, 1)
      y + Spacing - 1
    Next
    x + Spacing - 1
  Next
  ProcedureReturn ImageID
EndProcedure

  WindowWidth = 640
  WindowHeight = 480
  WindowTitle.s = "MyWindow"
  If OpenWindow(#Window_Main, 0, 0, WindowWidth, WindowHeight, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered | #PB_Window_Invisible, WindowTitle)
      SetWinBackgroundImage(WindowID(#Window_Main), DrawBackgroundImage(WindowWidth, WindowHeight, WindowTitle, WindowBackgroundColor = $300000, WindowFiligreeColor = $600000, Spacing = 60))
      AnimateWindow_(WindowID(#Window_Main), 1000, #AW_BLEND | #AW_ACTIVATE)
      AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Escape, #PB_Shortcut_Escape)
      AddKeyboardShortcut(#Window_Main, #PB_Shortcut_F1, #PB_Shortcut_F1)
      If CreateGadgetList(WindowID(#Window_Main))
      EndIf
      Quit = #False
      Repeat
        Select WindowEvent()
          Case #PB_Event_CloseWindow
            Quit = #True
          Case #PB_Event_Menu
            Select EventMenuID()
              Case #PB_Shortcut_Escape
                Quit = #True
              Case #PB_Shortcut_F1
                Statistics = 1 - Statistics
            EndSelect
          Case #PB_Event_SizeWindow
            WindowWidth = WindowWidth()
            WindowHeight = WindowHeight()
            If WindowWidth < 100
                WindowWidth = 100
            EndIf
            If WindowHeight < 100
                WindowHeight = 100
            EndIf
            SetWinBackgroundImage(WindowID(#Window_Main), DrawBackgroundImage(WindowWidth, WindowHeight, WindowTitle, WindowBackgroundColor = $300000, WindowFiligreeColor = $600000, Spacing = 60))
        EndSelect
        StartDrawing(WindowOutput())
          If Statistics
              BackColor(0, 0, 40)
              FrontColor(255, 255, 255)
              Locate(10, 10)
              DrawText("FPS : " + Str(FPS))
          EndIf
        StopDrawing()
        NFrames + 1
        If ElapsedMilliseconds() - tz => 1000
            FPS = NFrames
            NFrames = 0
            tz = ElapsedMilliseconds()
        EndIf
        Delay(1)
      Until Quit
      AnimateWindow_(WindowID(#Window_Main), 1000, #AW_BLEND | #AW_HIDE)
  EndIf
End
[/list][/list]
Mon avatar reproduit l'image de 4x1.8m présentée au 'Salon international du meuble de Paris' en janvier 2004, dans l'exposition 'Shades' réunisant 22 créateurs autour de Matt Sindall. L'original est un stratifié en 150 dpi.
Répondre