📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "演示"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4710
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4710
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command2
Caption = "写入"
Height = 495
Left = 2400
TabIndex = 7
Top = 1800
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "读取"
Height = 495
Left = 840
TabIndex = 6
Top = 1800
Width = 1215
End
Begin VB.TextBox Text3
Height = 375
Left = 1440
TabIndex = 5
Top = 1200
Width = 2055
End
Begin VB.TextBox Text2
Height = 375
Left = 1440
TabIndex = 3
Top = 720
Width = 2055
End
Begin VB.TextBox Text1
Height = 375
Left = 1440
TabIndex = 1
Top = 240
Width = 2055
End
Begin VB.Label Label3
Caption = "宽度:"
Height = 255
Left = 720
TabIndex = 4
Top = 1440
Width = 615
End
Begin VB.Label Label2
Caption = "高度:"
Height = 255
Left = 720
TabIndex = 2
Top = 840
Width = 615
End
Begin VB.Label Label1
Caption = "标题:"
Height = 255
Left = 720
TabIndex = 0
Top = 360
Width = 615
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function GetPrivateProfileInt Lib "Kernel32" _
Alias "GetPrivateProfileIntA" _
(ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal nDefault As Long, _
ByVal lpFileName As String) _
As Long
Private Declare Function GetPrivateProfileString Lib "Kernel32" _
Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String, _
ByVal lpKeyName As Any, _
ByVal lpDefault As String, _
ByVal lpReturnedString As String, _
ByVal nSize As Integer, _
ByVal lpFileName As String) _
As Integer
Private Declare Function WritePrivateProfileString Lib "Kernel32" _
Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpString As String, _
ByVal lpFileName As String) _
As Long
Private Declare Function GetPrivateProfileSection Lib "Kernel32" _
Alias "GetPrivateProfileSectionA" _
(ByVal lpAppName As String, _
ByVal lpReturnedString As String, _
ByVal nSize As Long, _
ByVal lpFileName As String) _
As Long
Private Declare Function WritePrivateProfileSection Lib "Kernel32" _
Alias "WritePrivateProfileSectionA" _
(ByVal lpAppName As String, _
ByVal lpString As String, _
ByVal lpFileName As String) _
As Long
Dim FILE_NAME As String
Private Sub Command1_Click()
FILE_NAME = App.Path + "\example.ini"
Dim strCaption As String * 256
Call GetPrivateProfileString("Form", "Title", "Default Caption", _
strCaption, 256, FILE_NAME)
Me.Caption = Trim(strCaption)
Me.Width = GetPrivateProfileInt("Form", "Width", Me.Width, FILE_NAME)
Me.Height = GetPrivateProfileInt("Form", "Height", Me.Height, FILE_NAME)
Text1.Text = Trim(strCaption)
Text2.Text = GetPrivateProfileInt("Form", "Width", Me.Width, FILE_NAME)
Text3.Text = GetPrivateProfileInt("Form", "Height", Me.Height, FILE_NAME)
End Sub
Private Sub Command2_Click()
Dim strCaption, strwidth, strheight As String
strCaption = Text1.Text
strwidth = Text2.Text
strheight = Text3.Text
Call WritePrivateProfileString("Form", "Title", strCaption, FILE_NAME)
Call WritePrivateProfileString("Form", "Width", strwidth, FILE_NAME)
Call WritePrivateProfileString("Form", "Height", strheight, FILE_NAME)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -