Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - Rotate text on label?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Rotate text on label?

 Post Reply Post Reply
Author
Message
chrisABC View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2008
Status: Offline
Points: 258
Post Options Post Options   Thanks (0) Thanks(0)   Quote chrisABC Quote  Post ReplyReply Direct Link To This Post Topic: Rotate text on label?
    Posted: 29 November 2009 at 8:20am
Is there any simple way (using CJ controls) to display a label with text rotated 90 degrees?
ie text going vertically down the page instead of horizontal?


Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6
Back to Top
gibra View Drop Down
Senior Member
Senior Member


Joined: 31 October 2008
Location: Italy
Status: Offline
Points: 288
Post Options Post Options   Thanks (0) Thanks(0)   Quote gibra Quote  Post ReplyReply Direct Link To This Post Posted: 01 December 2009 at 3:56am
I don't think make this possible.
 
You can only dispose text vertically (not rotate):
 

    With lblVertical
        .Alignment = xtpAlignCenter
        .Font.Name = "Tahoma"
        .Font.Size = 8
        .Height = 1650
        .Font.Bold = True
        .Width = 120
        .Caption = "V" & vbCr & "E" & vbCr & "R" & vbCr & "T" & vbCr & "I" & vbCr & "C" & vbCr & "A" & vbCr & "L"
    End With
 
 
gibra
CJ SuiteControl v: 13.x to 19.x
Windows 10 64bit
VS2019 - VB6.0 SP6
<a href="http://nuke.vbcorner.net/Home/tabid/36/language/en-US/Default.aspx" rel="nofollow">VS/VB 6.0 Installer v6.8
Back to Top
Krog View Drop Down
Groupie
Groupie


Joined: 06 February 2008
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote Krog Quote  Post ReplyReply Direct Link To This Post Posted: 09 January 2010 at 12:38pm
There are many ways to do it...

In VB6 we can use the CreateFont API function. Check the following test project:

20100109_120027_RotateText.rar


Another way would to be printing the text in a PictureBox and then rotating it using GetPixel and SetPixel, but it is more difficult.


In VB.Net we can use this:
Quote Public Class Form1

    Public Sub RotateText(ByVal g As Graphics, ByVal MyFont As Font, ByVal MyText As String, ByVal Angle As Single, ByVal MyBrush As Brush, ByVal X As Single, ByVal Y As Single)

        While Angle > 360
            Angle = Angle - 360
        End While
        While Angle < 0
            Angle = Angle + 360
        End While

        ' Create a matrix and rotate it n degrees.
        Dim MyMatrix As New System.Drawing.Drawing2D.Matrix
        MyMatrix.Rotate(Angle, Drawing2D.MatrixOrder.Append)

        ' Draw the text to the screen after applying the transform.
        g.Transform = myMatrix
        g.DrawString(MyText, MyFont, MyBrush, X, Y)

    End Sub

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint

        Dim NewFont = New Font("Arial", 12, FontStyle.Bold)

        ' Subroutine to alter text angle.
        RotateText(e.Graphics, NewFont, "Hello World", -45, Brushes.DarkBlue, 10, 100)

    End Sub
End Class


In VB.NET with XAML we can use also the RenderTransform or LayoutTransform.

The Codejock markup does not support these transformation functions.

Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows XP SP2
Language: Visual Basic 6 SP6
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.