📄 dlgremindtext.bas
字号:
Attribute VB_Name = "DlgRemindText"
Option Explicit
Private hFont As Long
Private hClockIcon As Long
Private Button As clsButton
Private RemindText As New clsDialog
Public strRemindText As String ' 全局变量文字提醒(Text)
Public Function CreateDlgRemindText(hWndParent As Long)
Call RemindText.CreateDialog(hWndParent, AddressOf DlgProc)
Set RemindText = Nothing
hFont = 0
End Function
Private Function DlgProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Select Case uMsg
Case WM_INITDIALOG
Dim lpRect As RECT, hDesktop As Long
hDesktop = GetDesktopWindow
Call GetWindowRect(hDesktop, lpRect)
Call MoveWindow(hWnd, (lpRect.Right - 268) / 2, (lpRect.Bottom - 128) / 2, 268, 128, 1)
Call SendMessage(hWnd, WM_SETTEXT, 0, ByVal "文字提示")
hFont = CreateFont(12, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, _
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, _
DEFAULT_PITCH Or FF_DONTCARE, "宋体")
Set Button = New clsButton
Button.CreateButton hWnd, "确定(&O)", 1, 99, 77, 70, 19, hFont, BS_DEFPUSHBUTTON
hClockIcon = LoadResImage(App.hInstance, 1, IMAGE_ICON, 0, 0, 0)
Case WM_PAINT
Dim lpPaint As PAINTSTRUCT
Dim hDc As Long
hDc = BeginPaint(hWnd, lpPaint)
SetBkMode hDc, NEWTRANSPARENT
SelectObject hDc, hFont
DrawFrame hDc, 8, 254, 66, 66
TextOut hDc, 55, 18, strRemindText, LenB(StrConv(strRemindText, vbFromUnicode))
Call DrawIconEx(hDc, 10, 10, hClockIcon, 0, 0, 0, 0, DI_NORMAL)
DrawButton hDc, 99, 171, 76, 97
Call EndPaint(hWnd, lpPaint)
Case WM_COMMAND
Select Case wParam
Case Is = 1
Call SendMessage(hWnd, WM_CLOSE, 0, ByVal 0)
End Select
Case WM_CLOSE
Set Button = Nothing
Call DestroyIcon(hClockIcon)
Call DeleteObject(hFont)
Call EndDialog(hWnd, 0)
End Select
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -