|
|
Riga 1: |
Riga 1: |
− | Il caso in oggetto è quello in cui si intende ruotare un testo qualsiasi secondo i raggi di una circonferenza. Pertanto il testo ruoterà avendo il suo margine sinistro corrispondente al centro della predetta circonferenza.
| + | #REDIRECT [[Curvare_il_testo_in_una_DrawingArea]] |
− | | |
− | Bisognerà utilizzare la Classe ''Paint'', ed in particolare le funzioni:
| |
− | * ''.Translate( )''
| |
− | * ''.Rotate( )''
| |
− | * ''.DrawText( )''
| |
− | | |
− | Sarà possibile ottenere, quanto previsto, mediante almeno tre oggetti.
| |
− | | |
− | | |
− | ===Uso di una ''DrawingArea''===
| |
− | <SUP>[[[#Note|nota 1]]]</sup>
| |
− | '''Public''' Sub Form_Open()
| |
− |
| |
− | With DrawingArea1
| |
− | .X = 0
| |
− | .Y = 0
| |
− | .W = 150
| |
− | .H = 150
| |
− | End With
| |
− |
| |
− | '''End'''
| |
− |
| |
− |
| |
− | '''Public''' Sub DrawingArea1_Draw()
| |
− |
| |
− | With Paint
| |
− | .Translate(0, 90)
| |
− | .Rotate(Rad(90))
| |
− | .DrawText("Testo", -20, 0, DrawingArea1.W, DrawingArea1.H, Align.Left)
| |
− | .End
| |
− | End With
| |
− |
| |
− | '''End'''
| |
− | | |
− | | |
− | ===Uso di una ''PictureBox''===
| |
− | '''Public''' Sub Form_Open()
| |
− |
| |
− | Dim im As Image
| |
− |
| |
− | With PictureBox1
| |
− | .X = 0
| |
− | .Y = 0
| |
− | .W = 150
| |
− | .H = 150
| |
− | End With
| |
− |
| |
− | im = New Image(PictureBox1.W, PictureBox1.H, Color.Transparent)
| |
− |
| |
− | With Paint
| |
− | .Begin(im)
| |
− | .Translate(0, 90)
| |
− | .Rotate(Rad(90))
| |
− | .DrawText("Testo qualsiasi !", -20, 0, PictureBox1.W, PictureBox1.H, Align.Left)
| |
− | .End
| |
− | End With
| |
− |
| |
− | PictureBox1.Image = im
| |
− | '''End'''
| |
− | | |
− | | |
− | ===Uso di una ''TextLabel''===
| |
− | '''Public''' Sub Form_Open()
| |
− |
| |
− | Dim im As Image
| |
− |
| |
− | With PictureBox1
| |
− | .X = 0
| |
− | .Y = 0
| |
− | .W = 150
| |
− | .H = 150
| |
− | End With
| |
− |
| |
− | im = New Image(TextLabel1.W, TextLabel1.H, Color.Transparent)
| |
− |
| |
− | With Paint
| |
− | .Begin(im)
| |
− | .Translate(0, 90)
| |
− | .Rotate(Rad(90))
| |
− | .DrawText("Hola, tincho !", -20, 0, TextLabel1.W, TextLabel1.H, Align.Left)
| |
− | .End
| |
− | End With
| |
− |
| |
− | im.Save("/tmp/immago.png", 100)
| |
− |
| |
− | TextLabel1.Text = "<IMG Src=/tmp/immago.png</img>"
| |
− |
| |
− | '''End'''
| |
− | | |
− | | |
− | | |
− | | |
− | =Note=
| |
− | [1] Rimandiamo anche a quest'altra pagina della WIKI: http://www.gambas-it.org/wiki/index.php?title=Ruotare_il_testo_in_una_DrawingArea
| |