⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module1.bas

📁 本文首先分析了自动组卷系统在具体的教学活动过程中的实际需求
💻 BAS
字号:
Attribute VB_Name = "Module1"


Public Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Public Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function ReleaseCapture Lib "user32" () As Long
Public Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, Y, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_SHOWWINDOW = &H40
Public Const TOPMOST_FLAGS = SWP_NOMOVE Or SWP_NOSIZE




Public Sub AlwaysOnTop(TheForm As Form, Toggle As Boolean)
85
    
    If Toggle = True Then
        SetWindowPos TheForm.hWnd, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS
    Else
        SetWindowPos TheForm.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS
    End If
End Sub

Public Sub DoDrag(TheForm As Form)
  
    ReleaseCapture
    SendMessage TheForm.hWnd, &HA1, 2, 0&
End Sub

Public Sub MakeWindow(TheForm As Form)
    
    TheForm.BackColor = RGB(207, 207, 207)
    TheForm.Caption = TheForm!lblTitle.Caption
    TheForm!lblTitle.Left = 16
    TheForm!lblTitle.Top = 7
    
    With TheForm!imgTitleLeft
        .Top = 0
        .Left = 0
    End With
    
    With TheForm!imgTitleRight
        .Top = 0
        .Left = (TheForm.Width / Screen.TwipsPerPixelX) - 19
    End With
    
    With TheForm!imgTitleMain
        .Top = 0
        .Left = 19
        .Width = (TheForm.Width / Screen.TwipsPerPixelX) - 19
    End With
    
    With TheForm!imgWindowLeft
        .Top = 30
        .Left = 0
        .Height = (TheForm.Height / Screen.TwipsPerPixelY) - 60
    End With
    
    With TheForm!imgWindowBottomLeft
        .Top = (TheForm.Height / Screen.TwipsPerPixelY) - 30
        .Left = 0
    End With
    
    With TheForm!imgWindowBottom
        .Top = (TheForm.Height / Screen.TwipsPerPixelY) - 30
        .Left = 19
        .Width = (TheForm.Width / Screen.TwipsPerPixelX) - 38
    End With
    
    With TheForm!imgWindowBottomRight
        .Top = (TheForm.Height / Screen.TwipsPerPixelY) - 30
        .Left = (TheForm.Width / Screen.TwipsPerPixelX) - 19
    End With
    
    With TheForm!imgWindowRight
        .Top = 30
        .Left = (TheForm.Width / Screen.TwipsPerPixelX) - 19
        .Height = (TheForm.Width / Screen.TwipsPerPixelX) - 38
    End With
    
  
     With TheForm!imgTitleClose
        .Top = 8
        .Left = (TheForm.Width / Screen.TwipsPerPixelX) - 22
    End With
    
    With TheForm!imgTitleMinimize
        .Top = 8
        .Left = (TheForm.Width / Screen.TwipsPerPixelX) - 39
    End With
           
    DoTransparency TheForm
End Sub

Public Sub DoTransparency(TheForm As Form)
    
    Dim TempRegions(6) As Long
    Dim FormWidthInPixels As Long
    Dim FormHeightInPixels As Long
    Dim a
    
    FormWidthInPixels = TheForm.Width / Screen.TwipsPerPixelX
    FormHeightInPixels = TheForm.Height / Screen.TwipsPerPixelY
    
   a = CreateRoundRectRgn(0, 0, FormWidthInPixels, FormHeightInPixels, 24, 24)

    a = SetWindowRgn(TheForm.hWnd, a, True)
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -