frmsetpage.frm
来自「这个是我以前做的一个客户管理系统.包内已经含有源码和所用到的控件.代码是用VB写」· FRM 代码 · 共 285 行
FRM
285 行
VERSION 5.00
Begin VB.Form frmSetPage
BorderStyle = 3 'Fixed Dialog
Caption = "页面设置"
ClientHeight = 3375
ClientLeft = 45
ClientTop = 330
ClientWidth = 4365
Icon = "frmSetPage.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3375
ScaleWidth = 4365
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
Caption = "对齐方式"
Height = 825
Left = 90
TabIndex = 11
Top = 90
Width = 4155
Begin VB.OptionButton optMid
Caption = "居中对齐"
Height = 375
Left = 2430
TabIndex = 13
Top = 315
Width = 1275
End
Begin VB.OptionButton optLeft
Caption = "左对齐"
Height = 330
Left = 585
TabIndex = 12
Top = 315
Width = 1635
End
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 375
Left = 2970
TabIndex = 10
Top = 2925
Width = 1275
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Height = 375
Left = 1485
TabIndex = 9
Top = 2925
Width = 1275
End
Begin VB.Frame Frame1
Caption = "页边距"
Height = 1860
Left = 90
TabIndex = 0
Top = 990
Width = 4155
Begin VB.TextBox txtRight
Height = 285
Left = 2565
TabIndex = 8
Text = "Text4"
Top = 1170
Width = 1185
End
Begin VB.TextBox txtLeft
Height = 285
Left = 810
TabIndex = 7
Text = "Text3"
Top = 1170
Width = 1185
End
Begin VB.TextBox txtBottom
Height = 285
Left = 2565
TabIndex = 6
Text = "Text2"
Top = 540
Width = 1185
End
Begin VB.TextBox txtTop
Height = 285
Left = 810
TabIndex = 5
Text = "Text1"
Top = 540
Width = 1185
End
Begin VB.Label Label4
Caption = "右:"
Height = 240
Left = 2160
TabIndex = 4
Top = 1215
Width = 690
End
Begin VB.Label Label3
Caption = "下:"
Height = 285
Left = 2160
TabIndex = 3
Top = 585
Width = 645
End
Begin VB.Label Label2
Caption = "左:"
Height = 240
Left = 360
TabIndex = 2
Top = 1215
Width = 645
End
Begin VB.Label Label1
Caption = "上:"
Height = 285
Left = 360
TabIndex = 1
Top = 585
Width = 645
End
End
End
Attribute VB_Name = "frmSetPage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public mbChanged As Boolean
Private Function mbSaveToINI() As Boolean
'************************************************************
'
'将设置的数据保存在gxwh.ini文件中
'
'************************************************************
Dim sFile As String
sFile = mGetWindowsPath() & "\gxwh.ini"
'*****************保存主标题字体信息
mbSaveValues "SetPage", "MarginLeft", CStr(gMargin.Marginleft), sFile
mbSaveValues "SetPage", "MarginRight", CStr(gMargin.MarginRight), sFile
mbSaveValues "SetPage", "MarginTop", CStr(gMargin.MarginTop), sFile
mbSaveValues "SetPage", "MarginBottom", CStr(gMargin.MarginBottom), sFile
mbSaveValues "SetPage", "AlignMent", CStr(gAlignment), sFile
mbSaveToINI = True
End Function
Private Function mbSaveOk() As Boolean
'***********************************************
'
'保存页边距离设置的结果
'
'***********************************************
'检查正确性
If txtLeft = "" Then
MsgBox "左边距不能为空!", vbInformation, ""
mbSaveOk = False
Exit Function
ElseIf txtRight = "" Then
MsgBox "右边距不能为空!", vbInformation, ""
mbSaveOk = False
Exit Function
ElseIf txtTop = "" Then
MsgBox "上边距不能为空!", vbInformation, ""
mbSaveOk = False
Exit Function
ElseIf txtBottom = "" Then
MsgBox "下边距不能为空!", vbInformation, ""
mbSaveOk = False
Exit Function
End If
If optLeft.Value Then
gMargin.Marginleft = txtLeft
gMargin.MarginRight = txtRight
gMargin.MarginBottom = txtBottom
gMargin.MarginTop = txtTop
Else
gMargin.Marginleft = 720
gMargin.MarginRight = 720
gMargin.MarginTop = txtTop
gMargin.MarginBottom = txtBottom
End If
mbSaveOk = True
End Function
Private Sub cmdCancel_Click()
mbChanged = False
Unload Me
End Sub
Private Sub cmdOk_Click()
If mbSaveOk() Then
If mbSaveToINI() Then
mbChanged = True
Me.Hide
Else
mbChanged = False
Unload Me
End If
Else
mbChanged = False
Unload Me
End If
End Sub
Private Sub Form_Load()
Center Me
If gAlignment = 1 Then
optLeft.Value = True
ElseIf gAlignment = 2 Then
optMid.Value = True
End If
txtTop.Text = gMargin.MarginTop
txtBottom.Text = gMargin.MarginBottom
txtLeft.Text = gMargin.Marginleft
txtRight.Text = gMargin.MarginRight
End Sub
Private Sub optLeft_Click()
txtLeft.Enabled = True
txtLeft.BackColor = vbWhite
txtRight.Enabled = True
txtRight.BackColor = vbWhite
gAlignment = 1
End Sub
Private Sub optMid_Click()
txtLeft.Enabled = False
txtLeft.BackColor = &H8000000F
txtRight.Enabled = False
txtRight.BackColor = &H8000000F
gAlignment = 2
End Sub
Private Sub txtBottom_GotFocus()
InitTextBox txtBottom
End Sub
Private Sub txtBottom_KeyPress(KeyAscii As Integer)
KeyAscii = gNumericKey(KeyAscii, True)
End Sub
Private Sub txtLeft_GotFocus()
InitTextBox txtLeft
End Sub
Private Sub txtLeft_KeyPress(KeyAscii As Integer)
KeyAscii = gNumericKey(KeyAscii, True)
End Sub
Private Sub txtRight_GotFocus()
InitTextBox txtRight
End Sub
Private Sub txtRight_KeyPress(KeyAscii As Integer)
KeyAscii = gNumericKey(KeyAscii, True)
End Sub
Private Sub txtTop_GotFocus()
InitTextBox txtTop
End Sub
Private Sub txtTop_KeyPress(KeyAscii As Integer)
KeyAscii = gNumericKey(KeyAscii, True)
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?