📄 frmpref.frm
字号:
VERSION 5.00
Begin VB.Form frmPref
BackColor = &H00A0D0D0&
BorderStyle = 4 'Fixed ToolWindow
Caption = "Preferences"
ClientHeight = 2505
ClientLeft = 45
ClientTop = 285
ClientWidth = 4875
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2505
ScaleWidth = 4875
ShowInTaskbar = 0 'False
StartUpPosition = 1 'CenterOwner
Begin VB.ComboBox cboLogLevel
Height = 315
ItemData = "frmPref.frx":0000
Left = 1755
List = "frmPref.frx":000D
TabIndex = 15
Top = 1350
Width = 1050
End
Begin VB.ComboBox cboConnections
Height = 315
Left = 1755
Sorted = -1 'True
Style = 2 'Dropdown List
TabIndex = 1
Top = 45
Width = 3075
End
Begin VB.CommandButton cmdReset
BackColor = &H00C0D0D0&
Caption = "&Reset"
Height = 420
Left = 1530
Style = 1 'Graphical
TabIndex = 8
Top = 2070
Width = 1050
End
Begin VB.CommandButton cmdCancel
BackColor = &H00C0D0D0&
Caption = "Cancel"
Height = 420
Left = 2655
Style = 1 'Graphical
TabIndex = 9
Top = 2070
Width = 1050
End
Begin VB.CommandButton cmdOk
BackColor = &H00C0D0D0&
Caption = "&Save"
Default = -1 'True
Height = 420
Left = 3780
Style = 1 'Graphical
TabIndex = 10
Top = 2070
Width = 1050
End
Begin VB.TextBox txtAutoConnectDelay
Height = 285
Left = 1755
TabIndex = 7
Top = 1035
Width = 645
End
Begin VB.TextBox txtPingDelay
Height = 285
Left = 1755
TabIndex = 5
Top = 720
Width = 645
End
Begin VB.TextBox txtPingHost
Height = 285
Left = 1755
TabIndex = 3
Top = 405
Width = 3075
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "&Log level:"
Height = 195
Index = 6
Left = 0
TabIndex = 14
Top = 1395
Width = 1680
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "(Restart the program to apply your changes)"
Height = 240
Left = 1620
TabIndex = 13
Top = 1800
Width = 3210
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "(seconds; max=60)"
Height = 195
Index = 5
Left = 2475
TabIndex = 12
Top = 765
Width = 2355
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "(0=no autoconnection; max=60)"
Height = 195
Index = 4
Left = 2475
TabIndex = 11
Top = 1080
Width = 2355
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "&Autoconnection delay:"
Height = 195
Index = 3
Left = 0
TabIndex = 6
Top = 1080
Width = 1680
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "Ping &delay (s):"
Height = 195
Index = 2
Left = 585
TabIndex = 4
Top = 720
Width = 1095
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "Ping this &host:"
Height = 195
Index = 1
Left = 585
TabIndex = 2
Top = 405
Width = 1095
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "&Connect to:"
Height = 195
Index = 0
Left = 675
TabIndex = 0
Top = 45
Width = 1005
End
End
Attribute VB_Name = "frmPref"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' RICHARD GOUTORBE ( rghome@reseau.org http://www.reseau.org/rg/ ) holds the copyright to all code in this document.
' You are granted a license to use this code under the following conditions:
' - You are free to modify the code in any way you see fit.
' - You are free to redistribute the code FOR NON-PROFIT PURPOSE provided that
' 1) appropriate credit is given to Richard Goutorbe, and
' 2) you do not charge any kind of fee for the code without the written permission of Richard Goutorbe.
' You are free to redistibute a binary compiled version of the code for any purpose, profit or non-profit.
' If you distribute the code in this form, you must give appropriate credit to Richard Goutorbe.
' PUBLISHING THE CODE ON OTHER WEB SITES, OR POSTING THE CODE ON OTHER WEB SITES FOR PUBLICATION WITHOUT THE WRITTEN PERMISSION OF RICHARD GOUTORBE, IS STRICTLY PROHIBITED.
Option Explicit
Public mPref_obj As CPref
Public Property Get Owner() As CPref
Set Owner = mPref_obj
End Property
Public Property Set Owner(pref_obj As CPref)
Set mPref_obj = pref_obj
load_controls
End Property
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOk_Click()
save_controls
mPref_obj.SavePref
Unload Me
End Sub
Private Sub cmdReset_Click()
mPref_obj.Reset
load_controls
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set mPref_obj = Nothing
End Sub
Private Sub load_controls()
select_cboLogLevel mPref_obj.LogLevel
Me.txtAutoConnectDelay = mPref_obj.AutoConnectDelay
Me.txtPingDelay = mPref_obj.PingDelay
Me.txtPingHost = mPref_obj.PingHost
frmMain.Load_ListRas Me.cboConnections
End Sub
Private Sub save_controls()
mPref_obj.LogLevel = Me.cboLogLevel.ItemData(Me.cboLogLevel.ListIndex)
mPref_obj.AutoConnectDelay = Me.txtAutoConnectDelay
mPref_obj.PingDelay = Me.txtPingDelay
mPref_obj.PingHost = Me.txtPingHost
With Me.cboConnections
If (.ListIndex >= 0) Then
mPref_obj.RASConnection = .List(.ListIndex)
Else
If (.ListCount > 0) Then
mPref_obj.RASConnection = .List(0)
Else
mPref_obj.RASConnection = ""
End If
End If
End With
MsgBox "You must restart the program to apply your changes" _
, vbInformation, App.Title
End Sub
Private Sub select_cboLogLevel(level As Integer)
Dim idx As Integer
With Me.cboLogLevel
.ListIndex = 0 ' default
For idx = 0 To .ListCount - 1
If (.ItemData(idx) = level) Then
.ListIndex = idx
Exit For
End If
Next
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -