www.pudn.com > Super_richBoxall.zip > frmParagraph.frm


VERSION 5.00 
Begin VB.Form frmParagraph  
   Caption         =   "Paragraph Formatting" 
   ClientHeight    =   4500 
   ClientLeft      =   7260 
   ClientTop       =   2475 
   ClientWidth     =   5565 
   BeginProperty Font  
      Name            =   "Tahoma" 
      Size            =   8.25 
      Charset         =   0 
      Weight          =   400 
      Underline       =   0   'False 
      Italic          =   0   'False 
      Strikethrough   =   0   'False 
   EndProperty 
   Icon            =   "frmParagraph.frx":0000 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   4500 
   ScaleWidth      =   5565 
   Begin VB.CommandButton cmdOK  
      Caption         =   "OK" 
      Default         =   -1  'True 
      Height          =   375 
      Left            =   4200 
      TabIndex        =   20 
      Top             =   60 
      Width           =   1275 
   End 
   Begin VB.CommandButton cmdCancel  
      Cancel          =   -1  'True 
      Caption         =   "Cancel" 
      Height          =   375 
      Left            =   4200 
      TabIndex        =   19 
      Top             =   480 
      Width           =   1275 
   End 
   Begin VB.Frame fraLineSpacing  
      Caption         =   "&Line Spacing (See type for measurement details)" 
      Height          =   1155 
      Left            =   60 
      TabIndex        =   6 
      Top             =   3240 
      Width           =   4035 
      Begin VB.ComboBox cboType  
         Height          =   315 
         Left            =   1680 
         Style           =   2  'Dropdown List 
         TabIndex        =   10 
         Top             =   240 
         Width           =   2175 
      End 
      Begin VB.TextBox txtAmount  
         Height          =   315 
         Left            =   1680 
         TabIndex        =   7 
         Top             =   660 
         Width           =   2175 
      End 
      Begin VB.Label lblType  
         Caption         =   "T&ype:" 
         Height          =   195 
         Left            =   180 
         TabIndex        =   9 
         Top             =   300 
         Width           =   1395 
      End 
      Begin VB.Label Label1  
         Caption         =   "Amoun&t" 
         Height          =   195 
         Left            =   180 
         TabIndex        =   8 
         Top             =   720 
         Width           =   1935 
      End 
   End 
   Begin VB.Frame fraSpacing  
      Caption         =   "Paragraph &Spacing (In Twips = inches/1440)" 
      Height          =   1155 
      Left            =   60 
      TabIndex        =   1 
      Top             =   2040 
      Width           =   4035 
      Begin VB.TextBox txtAfter  
         Height          =   315 
         Left            =   1680 
         TabIndex        =   5 
         Top             =   660 
         Width           =   2175 
      End 
      Begin VB.TextBox txtBefore  
         Height          =   315 
         Left            =   1680 
         TabIndex        =   4 
         Top             =   240 
         Width           =   2175 
      End 
      Begin VB.Label lblAfter  
         Caption         =   "A&fter Paragraph:" 
         Height          =   195 
         Left            =   180 
         TabIndex        =   3 
         Top             =   720 
         Width           =   1395 
      End 
      Begin VB.Label lblBefore  
         Caption         =   "&Before Paragraph:" 
         Height          =   195 
         Left            =   180 
         TabIndex        =   2 
         Top             =   300 
         Width           =   1395 
      End 
   End 
   Begin VB.Frame fraIndents  
      Caption         =   "&Indents and Alignment (In Inches)" 
      Height          =   1935 
      Left            =   60 
      TabIndex        =   0 
      Top             =   60 
      Width           =   4035 
      Begin VB.ComboBox cboAlignment  
         Height          =   315 
         Left            =   1620 
         Style           =   2  'Dropdown List 
         TabIndex        =   18 
         Top             =   1500 
         Width           =   2175 
      End 
      Begin VB.TextBox txtFirstLine  
         Height          =   315 
         Left            =   1620 
         TabIndex        =   16 
         Top             =   960 
         Width           =   2175 
      End 
      Begin VB.TextBox txtRight  
         Height          =   315 
         Left            =   1620 
         TabIndex        =   14 
         Top             =   600 
         Width           =   2175 
      End 
      Begin VB.TextBox txtLeft  
         Height          =   315 
         Left            =   1620 
         TabIndex        =   12 
         Top             =   240 
         Width           =   2175 
      End 
      Begin VB.Label lblAlign  
         Caption         =   "T&ype:" 
         Height          =   195 
         Left            =   120 
         TabIndex        =   17 
         Top             =   1560 
         Width           =   1395 
      End 
      Begin VB.Label lblFirstLine  
         Caption         =   "Fir&st Line" 
         Height          =   195 
         Left            =   120 
         TabIndex        =   15 
         Top             =   1020 
         Width           =   1395 
      End 
      Begin VB.Label lblRight  
         Caption         =   "&Right:" 
         Height          =   195 
         Left            =   120 
         TabIndex        =   13 
         Top             =   660 
         Width           =   1395 
      End 
      Begin VB.Label lblLeft  
         Caption         =   "&Left:" 
         Height          =   195 
         Left            =   120 
         TabIndex        =   11 
         Top             =   300 
         Width           =   1395 
      End 
   End 
End 
Attribute VB_Name = "frmParagraph" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Option Explicit 
 
Private m_edt As vbalRichEdit 
Private m_bCancel As Boolean 
 
Public Property Let RichEdit(ByVal edtThis As vbalRichEdit) 
   Set m_edt = edtThis 
End Property 
 
Private Sub cboType_Click() 
   txtAmount.Enabled = (cboType.ListIndex > 2) 
End Sub 
 
Private Sub cmdCancel_Click() 
   Unload Me 
End Sub 
 
Private Sub cmdOK_Click() 
On Error GoTo OKError 
 
   m_bCancel = False 
    
   ' Line spacing: 
   Dim eStyle As ERECParagraphLineSpacingConstants 
   Dim ySpace As Long 
   eStyle = cboType.ListIndex 
   ySpace = CLng(txtAmount.Text) 
   m_edt.SetParagraphLineSpacing eStyle, ySpace 
    
   ' Offsets/align: 
   Dim lFIrstLine As Long, lLeft As Long, lRight As Long 
   Dim sFirstLine As Single, sLeft As Single, sRight As Single 
   sFirstLine = CSng(txtFirstLine) 
   sLeft = CSng(txtLeft.Text) 
   sRight = CSng(txtRight.Text) 
   lFIrstLine = sFirstLine * 1440 
   lRight = sRight * 1440 
   lLeft = sLeft * 1440 
   m_edt.SetParagraphOffsets lFIrstLine, lLeft, lRight 
   ' Align: 
   m_edt.ParagraphAlignment = cboAlignment.ListIndex + 1 
    
   ' Paragraph spacing: 
   Dim lAfter As Long, lBefore As Long 
   Dim sAfter As Single, sBefore As Single 
   lAfter = CLng(txtAfter.Text) 
   lBefore = CLng(txtBefore.Text) 
   m_edt.SetParagraphSpacing lAfter, lBefore 
    
   Unload Me 
   Exit Sub 
    
OKError: 
   MsgBox "One or more numeric parameters could not be interpreted.", vbInformation 
   Exit Sub 
End Sub 
 
Private Sub Form_Load() 
 
   cboAlignment.AddItem "Left" 
   cboAlignment.AddItem "Centre" 
   cboAlignment.AddItem "Right" 
   cboAlignment.AddItem "Justify" 
   cboType.AddItem "Single Line" 
   cboType.AddItem "One and a Half Lines" 
   cboType.AddItem "Double" 
   cboType.AddItem "Twips, no less than single line" 
   cboType.AddItem "Twips, unrestricted" 
   cboType.AddItem "1/20th Line" 
    
   ' Line spacing: 
   Dim eStyle As ERECParagraphLineSpacingConstants 
   Dim ySpace As Long 
   m_edt.GetParagraphLineSpacing eStyle, ySpace 
   cboType.ListIndex = eStyle 
   txtAmount.Text = ySpace 
 
   ' Offsets/alignment: 
   Dim lFIrstLine As Long, lLeft As Long, lRight As Long 
   Dim sFirstLine As Single, sLeft As Single, sRight As Single 
   m_edt.GetParagraphOffsets lFIrstLine, lLeft, lRight 
   sFirstLine = lFIrstLine / 1440#: sLeft = lLeft / 1440#: sRight = lRight / 1440# 
   txtFirstLine.Text = sFirstLine 
   txtLeft.Text = sLeft 
   txtRight.Text = sRight 
   cboAlignment.ListIndex = m_edt.ParagraphAlignment - 1 
    
   ' Paragraph spacing: 
   Dim lAfter As Long, lBefore As Long 
   Dim sAfter As Single, sBefore As Single 
   m_edt.GetParagraphSpacing lAfter, lBefore 
   txtAfter.Text = lAfter 
   txtBefore.Text = lBefore 
 
End Sub