Ik wil een in een picturebox met de muis of pen geschreven tekst 90 graden roteren.
Graag zou ik dit doen zonder iets naar de harde schijf te schrijven.
De gebruikte code om de tekst te schrijven staat hieronder.
Dank bij voorbaat.
Public Class Form1
Private _Previous As System.Nullable(Of Point) = Nothing
Private grxp As Graphics
Private ink As Pen = New Pen(Color.MidnightBlue, 1)
Dim NewCurP As Point
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
grxp = PictureBox1.CreateGraphics
grxp.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
NewCurP = New Point(0, 0)
Me.DoubleBuffered = True
End Sub
Private Sub pictureBox1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
If Not e.Button = MouseButtons.Left Then Exit Sub
grxp.DrawLine(ink, NewCurP, e.Location) 'mouse)
NewCurP = e.Location 'mouse
End Sub
Private Sub pictureBox1_MouseDown(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseDown
NewCurP = e.Location
End Sub
Private Sub Button1_Click(sender As Object, e As MouseEventArgs) Handles Button1.Click
grxp.Clear(Color.White)
End Sub
End Class
Graag zou ik dit doen zonder iets naar de harde schijf te schrijven.
De gebruikte code om de tekst te schrijven staat hieronder.
Dank bij voorbaat.
Public Class Form1
Private _Previous As System.Nullable(Of Point) = Nothing
Private grxp As Graphics
Private ink As Pen = New Pen(Color.MidnightBlue, 1)
Dim NewCurP As Point
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
grxp = PictureBox1.CreateGraphics
grxp.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
NewCurP = New Point(0, 0)
Me.DoubleBuffered = True
End Sub
Private Sub pictureBox1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
If Not e.Button = MouseButtons.Left Then Exit Sub
grxp.DrawLine(ink, NewCurP, e.Location) 'mouse)
NewCurP = e.Location 'mouse
End Sub
Private Sub pictureBox1_MouseDown(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseDown
NewCurP = e.Location
End Sub
Private Sub Button1_Click(sender As Object, e As MouseEventArgs) Handles Button1.Click
grxp.Clear(Color.White)
End Sub
End Class