回覆列表
  • 1 # 使用者4912889400776

    先呼叫API函式實現窗體總在最上,程式碼如下:

    Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

    Const HWND_TOPMOST = -1

    Private Sub Form_Load()

    "總在最上

    SetWindowPos Me.hwnd, HWND_TOPMOST, Me.Left / Screen.TwipsPerPixelX _

    , Me.Top \ Screen.TwipsPerPixelY, Me.Width \ Screen.TwipsPerPixelX, _

    Me.Height \ Screen.TwipsPerPixelY, 0

    End Sub

    然後在顯示這個窗體時用模態,例如:

    假設上面的窗體為Form1

    Form1.Show vbModal

    這樣窗體不僅會在最上,而且必須輸入正確的密碼才能訪問別的窗體

  • 中秋節和大豐收的關聯?
  • windows7原版系統如何使用Administrator帳戶?