📄 modproperties.bas
字号:
Attribute VB_Name = "modProperties"
Option Explicit
'
' This is the main module for the Command project. It includes constants and Windows API
' declarations needed for the Command.
'
'
' Global variables
'
Global gobjGeoApp As Object
' For Help
Global Const HELP_CONTEXT = 1
'
' Declare the rectangle type for use in GetWindowRect
'
Type RectType
iLeft As Long
iTop As Long
iright As Long
ibottom As Long
End Type
'
' Declare the Windows function that allows us to center a form either on the screen
' or within the application.
'
Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RectType) As Long
'
' show help
'
Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long, _
ByVal lpHelpFile As String, _
ByVal wCommand As Long, _
ByVal dwData As Long) As Long
'
' This function centers a form either on the screen if the hWndParent is 0 or within
' the parent. Copied from VBProgrammers Journal OCT 95 and modified for our needs.
'
Sub CenterForm(ByVal hWndParent As Long, frmForm As Form)
Dim iLeft As Long
Dim iTop As Long
Dim iMidX As Long
Dim iMidY As Long
Dim rcParent As RectType
'Find the ideal center point
If hWndParent = 0 Then
' No parent, center over the screen using the screen object
iMidX = Screen.Width / 2
iMidY = Screen.Height / 2
Else
' Center within the form's parent
Call GetWindowRect(hWndParent, rcParent)
' in calculating mid x it seems to me that we should left*twipsX and right*twipsX
' rather than right*twipsY
iMidX = ((rcParent.iLeft * Screen.TwipsPerPixelX) + _
(rcParent.iright * Screen.TwipsPerPixelY)) / 2
iMidY = ((rcParent.iTop * Screen.TwipsPerPixelY) + _
(rcParent.ibottom * Screen.TwipsPerPixelY)) / 2
' If the application is maximized or the app for some reason returns all 0 in the
' rectangle type, then center on the screen
If (rcParent.iLeft = 0 And rcParent.iright = 0 And _
rcParent.iTop = 0 And rcParent.ibottom = 0) Then
iMidX = Screen.Width / 2
iMidY = Screen.Height / 2
End If
End If
' Find the form's upper left based on that
iLeft = iMidX - (frmForm.Width / 2)
iTop = iMidY - (frmForm.Height / 2)
' If the form is outside the screen, move it inside
If iLeft < 0 Then
iLeft = 0
ElseIf (iLeft + frmForm.Width) > Screen.Width Then
iLeft = Screen.Width - frmForm.Width
End If
If iTop < 0 Then
iTop = 0
ElseIf (iTop + frmForm.Height) > Screen.Height Then
iTop = Screen.Height - frmForm.Height
End If
' Move the form to its new position
frmForm.Move iLeft, iTop
End Sub
'
' This is the main function which is the entry point for the OLE server.
' Only initialization logic which is common to all Commands in this server
' should be placed in this subroutine.
'
Sub Main()
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -