Text Rotate

Category: Rotation

Date: 02-16-2022

Return to Index


 
'Credit:  PB Samples
 
'Compilable Example:  (Jose Includes)
'====================================================================
'
'  TextRotate.bas for PowerBASIC Compiler for Windows
'  Copyright (c) 2005 - 2011 PowerBASIC, Inc.
'  All Rights Reserved.
'
'  Print rotated text in a Graphic control by creating a rotated
'  font and selecting it into the control's DC before printing.
'
'====================================================================
#Compiler PBWin 10
#Compile EXE
'--------------------------------------------------------------------
%IDC_GRAPHIC1  = 111
'--------------------------------------------------------------------
 
'********************************************************************
 
Function PBMain () As Long
   '--------------------------------------------------------------------
   ' Program entrance
   '--------------------------------------------------------------------
   Local hDlg, hDC, hFont900, hFont300 As Dword
 
   Dialog New Pixels, 0, "Graphic Text Rotation",,, 500, 400, _
      %WS_Caption Or %WS_SysMenu, 0 To hDlg
 
   '------------------------------------------------------------------
   Control Add Graphic, hDlg, %IDC_GRAPHIC1,"", 0, 0, 500, 400
   Graphic Attach hDlg, %IDC_GRAPHIC1
   Graphic Clear RGB(192, 0, 0)
 
   '------------------------------------------------------------------
   ' Print some rotated text, Create a rotated font, select it into the
   ' attached graphic control, print text. Remember that for example
   ' text width becomes text height with a 90 degree font..
   '------------------------------------------------------------------
   Graphic Box (0, 0) - (80, 400),,RGB(0, 0, 64), RGB(0, 64, 128)
   Graphic Color %Yellow, -2
 
   Font New "Times New Roman", 40, 1, 1, 0, 900 To hFont900
   Graphic Set Font hFont900
 
   Graphic Set Pos (0, 400)
   Graphic Print " PowerBASIC "
 
   Font New "Times New Roman", 40, 1, 1, 0, 300 To hFont300
   Graphic Set Font hFont300
 
   Graphic Set Pos (90, 180)
   Graphic Print "Graphic Print"
   Graphic Set Pos (100, 250)
   Graphic Print "in any angle!"
 
   '------------------------------------------------------------------
   Dialog Show Modal hDlg Call DlgProc
 
   Font End hFont900
   Font End hFont300
 
End Function
 
   '��������������������������������������������������������������������
 
CallBack Function DlgProc() As Long
   '--------------------------------------------------------------------
   ' Main dialog callback procedure
   '--------------------------------------------------------------------
 
   Select Case Cb.Msg
      Case %WM_Command
         Select Case Cb.Ctl
            Case %IdCancel
               If Cb.CtlMsg = %BN_Clicked Then
                  Dialog End Cb.Hndl
               End If
 
         End Select
 
   End Select
 
End Function
 
'gbs_00920
'Date: 03-10-2012


created by gbSnippets
http://www.garybeene.com/sw/gbsnippets.htm