Text Orientation Question...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve Gdula

    Text Orientation Question...

    I am wondering if anyone knows if it is
    possible to change the display orientation
    of a label so that the text may be displayed
    vertically rather than horizontally.

    I have seen reference to API calls that can
    draw text at various angles, but before I commit
    to the research and learing curve time, I am
    hoping that a simpler method may exist. Point me
    in a direction if it exists!

    Thanks,

    -Steve.
  • Stephane Richard

    #2
    Re: Text Orientation Question...

    Unless you happen to find a custom control (OCX) that does it, API seems
    tobe the only way to go.

    Here's two places where you might be lucky and save yourself some time.


    and


    hope this helps

    --
    Stéphane Richard
    Senior Software and Technology Supervisor

    For all your hosting and related needs


    "Steve Gdula" <stevegdula@yah oo.com> wrote in message
    news:cae000cd.0 307220634.761ee 070@posting.goo gle.com...[color=blue]
    > I am wondering if anyone knows if it is
    > possible to change the display orientation
    > of a label so that the text may be displayed
    > vertically rather than horizontally.
    >
    > I have seen reference to API calls that can
    > draw text at various angles, but before I commit
    > to the research and learing curve time, I am
    > hoping that a simpler method may exist. Point me
    > in a direction if it exists!
    >
    > Thanks,
    >
    > -Steve.[/color]


    Comment

    • Steve Gdula

      #3
      Re: Text Orientation Question...

      Thanks for the Links Stéphane, and YES API looks like
      the way to I have to go.

      After being dejected (cause I hate API calls) it turns
      out it wasn't so tough after all.

      For the benefit of all:

      Private Declare Function CreateFont Lib "gdi32" Alias "CreateFont A" _
      (ByVal H As Long, ByVal W As Long, ByVal E As Long, ByVal O As Long, _
      ByVal W As Long, ByVal I As Long, ByVal u As Long, ByVal S As Long, _
      ByVal C As Long, ByVal OP As Long, ByVal CP As Long, ByVal Q As Long,
      _
      ByVal PAF As Long, ByVal F As String) As Long

      Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long,
      ByVal hObject As Long) As Long

      Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As
      Long) As Long

      Within the CreateFont Function the
      4'th parameter 'E' meaning (escapement) is actually the angle
      in units of tenths of degrees to rotate the text. The 5'th parameter
      'O' meaning (orientation) is ignored from what I understand.

      '-------------Sample code utilized with good results------------------
      'Display text test
      Dim lngNewFont As Long, lngOldFont As Long

      'Create the LOGICAL Font 'Handle?'
      lngNewFont = CreateFont(20, 0, -220, 0, FW_NORMAL, 0, 0, 0,
      ANSI_CHARSET, OUT_DEFAULT_PRE CIS, _
      1, PROOF_QUALITY, VARIABLE_PITCH Or FF_ROMAN Or 4, "TimesNewRoman" )

      'Select new Font as current font, and store handle to previous font.
      lngOldFont = SelectObject(fr mMyForm.hdc, lngNewFont)

      'Display the Text
      frmBatesAnalyze r.CurrentX = 150
      frmBatesAnalyze r.CurrentY = 300
      frmBatesAnalyze r.Print "Sample Text"

      'Reselect orig font.
      lngNewFont = SelectObject(fr mMyForm.hdc, lngOldFont)

      'Free up un-necessary resourses
      DeleteObject lngNewFont
      '-------------------------------------------------------------------
      All the Font Constants were easily available in the API viewer that
      comes with the VB IDE.

      Comment

      • Tony

        #4
        Re: Text Orientation Question...

        On 22 Jul 2003 07:34:13 -0700, stevegdula@yaho o.com (Steve Gdula)
        wrote:
        [color=blue]
        >I am wondering if anyone knows if it is
        >possible to change the display orientation
        >of a label so that the text may be displayed
        >vertically rather than horizontally.
        >
        >I have seen reference to API calls that can
        >draw text at various angles, but before I commit
        >to the research and learing curve time, I am
        >hoping that a simpler method may exist. Point me
        >in a direction if it exists!
        >
        >Thanks,
        >
        >-Steve.[/color]

        I'm still a newbie at this stuff, but would this do what you want?

        label1.caption= "H" & vbcrlf & "E" & vbcrlf & "L" & vbcrlf & "L" &
        vbcrlf & "O"

        And draw the label vertically instead of horizontally on the form.

        Tony!

        Comment

        • George Bashore

          #5
          Re: Text Orientation Question...

          Steve try this
          1 form
          1 label
          this code

          Option Explicit

          Private Sub Form_Load()
          Dim NumString As String
          Dim StringLen As Long
          Dim LoopChars As Long
          Dim OutString As String
          NumString = Label1.Caption
          StringLen = Len(NumString)
          For LoopChars = 1 To StringLen
          OutString = OutString & (Mid$(NumString , LoopChars, 1) & vbNewLine)
          Next LoopChars
          Label1.Caption = OutString
          Label1.AutoSize = True
          End Sub

          HTH
          George


          "Steve Gdula" <stevegdula@yah oo.com> wrote in message
          news:cae000cd.0 307220634.761ee 070@posting.goo gle.com...[color=blue]
          > I am wondering if anyone knows if it is
          > possible to change the display orientation
          > of a label so that the text may be displayed
          > vertically rather than horizontally.
          >
          > I have seen reference to API calls that can
          > draw text at various angles, but before I commit
          > to the research and learing curve time, I am
          > hoping that a simpler method may exist. Point me
          > in a direction if it exists!
          >
          > Thanks,
          >
          > -Steve.[/color]


          Comment

          • Steve Gdula

            #6
            Re: Text Orientation Question...

            Thanks George and Tony for excellent ideas.

            I failed to elaborate on my original message the
            fact that not only did I need the information
            displayed in a vertical format, but the characters
            had to be rotated -90 degrees as well. Your suggestion
            would stack the characters directly on top of one
            another, but at their standard zero degree declination.

            ----- my original message --------------[color=blue]
            > I am wondering if anyone knows if it is
            > possible to change the display orientation
            > of a label so that the text may be displayed
            > vertically rather than horizontally.[/color]
            ----------------------------------------

            Thanks for all help!

            --Steve.

            Comment

            Working...