⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pagesetup.frm

📁 文档编程软件,类似WORD的一个编辑工具.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmPageSetup 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "页面设置"
   ClientHeight    =   1185
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   3045
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1185
   ScaleWidth      =   3045
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  '所有者中心
   Begin VB.Frame Frame1 
      Caption         =   "页边距"
      Height          =   1155
      Left            =   0
      TabIndex        =   2
      Top             =   0
      Width           =   1695
      Begin VB.TextBox txtLeft 
         Height          =   285
         Left            =   660
         TabIndex        =   4
         Top             =   300
         Width           =   855
      End
      Begin VB.TextBox txtRight 
         Height          =   285
         Left            =   660
         TabIndex        =   3
         Top             =   720
         Width           =   855
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "左(&L):"
         Height          =   180
         Left            =   120
         TabIndex        =   6
         Top             =   360
         Width           =   540
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "右(&R):"
         Height          =   180
         Left            =   120
         TabIndex        =   5
         Top             =   780
         Width           =   540
      End
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   375
      Left            =   1800
      TabIndex        =   1
      Top             =   75
      Width           =   1200
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   375
      Left            =   1800
      TabIndex        =   0
      Top             =   525
      Width           =   1200
   End
End
Attribute VB_Name = "frmPageSetup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'部分版权(C) 1995, Microsoft Corporation ---HHZealot 翻译--
Option Explicit

'*************************************************
' 目的:  卸载窗体
'*************************************************
Private Sub cmdCancel_Click()
    Unload Me
End Sub

'*************************************************
' 目的:  更新活动的 RTF 控件中的文字的格式
'*************************************************
Private Sub cmdOK_Click()
    '在文本框中验证边距值
    If Val(txtLeft.Text) < 0 Then
        Beep '发出声音
        '显示错误
        MsgBox "左边距必须不小于 0 英寸。", 16, "边距超出范围"
        '选择带有错误的文本框
        txtLeft.SelStart = 0
        txtLeft.SelLength = Len(txtLeft.Text)
        '设置焦点
        txtLeft.SetFocus
    ElseIf Val(txtRight.Text) < 0 Then
        Beep
        '显示错误
        MsgBox "右边距必须不小于 0 英寸。", 16, "边距超出范围"
        '选择带有错误的文本框
        txtRight.SelStart = 0
        txtRight.SelLength = Len(txtRight.Text)
        '设置焦点
        txtRight.SetFocus
    Else
        '通过检查
        '用于存贮原来的选择的变量
        Dim lngOldStart As Long
        Dim lngOldLength As Long
        With frmDDWordPadMDI.ActiveForm.rtf
            '存储原来的所选文本
            lngOldStart = .SelStart
            lngOldLength = .SelLength
            '选择全部文档
            .SelStart = 0
            .SelLength = Len(.Text)
            '设置新的页边距,这个值必须把单位被转换为缇,每英寸 1440 缇。
            .SelIndent = CInt(Val(txtLeft.Text) * 1440)
            .SelRightIndent = CInt(Val(txtRight.Text) * 1440)
            '恢复旧的所选项
            .SelStart = lngOldStart
            .SelLength = lngOldLength
        End With
        '卸载窗体
        Unload Me
    End If
End Sub

'*************************************************
' 目的:  初始化窗体的页边距数据
'*************************************************
Private Sub Form_Load()
    With frmDDWordPadMDI.ActiveForm.rtf
        '用于存储新的值的变量
        Dim sglLeft As Single
        Dim sglRight As Single
        '从这里获得设置一些变量的置。
        '我要通过少许额外的步骤来确定当从整数转变为浮点值时我不失去一些精度
        sglLeft = .SelIndent
        sglLeft = sglLeft / 1440#
        sglLeft = CInt(sglLeft * 100#)
        sglLeft = sglLeft / 100#
        txtLeft.Text = Trim(Str(sglLeft))
        sglRight = .SelRightIndent
        sglRight = sglRight / 1440#
        sglRight = CInt(sglRight * 100#)
        sglRight = sglRight / 100#
        txtRight.Text = Trim(Str(sglRight))
    End With
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -