• XYShowLabel


    ‎August ‎12, ‎2018那天下午写的一个简单的VB小程序,主要用于电脑录屏时显示预先设置好的文本,就像电影字幕一样。

    需要提前将文本准备在应用程序目录下的XYShowLabel.txt文件中,按方向键右(→)可以往下翻。

    主界面窗体文件(main.frm):

    VERSION 5.00
    Begin VB.Form main 
       BorderStyle     =   1  'Fixed Single
       ClientHeight    =   1215
       ClientLeft      =   45
       ClientTop       =   375
       ClientWidth     =   13170
       MaxButton       =   0   'False
       MinButton       =   0   'False
       ScaleHeight     =   1215
       ScaleWidth      =   13170
       StartUpPosition =   2  '屏幕中心
       Begin VB.Label out 
          Alignment       =   2  'Center
          BackStyle       =   0  'Transparent
          Caption         =   "User:Leisureeen"
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   48
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   975
          Left            =   0
          TabIndex        =   0
          Top             =   120
          Width           =   13095
       End
    End
    Attribute VB_Name = "main"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    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
    Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Private outTmp As String
    
    Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
        On Error Resume Next
        Dim capTmp As String
        If KeyCode = 37 Then
            capTmp = VBA.InputBox("Please Set the Title.", "Setting", main.Caption)
            If Len(capTmp) > 1 Then main.Caption = capTmp
        ElseIf KeyCode = 39 Then
            Line Input #1, outTmp
            If out.Caption <> outTmp Then out.Caption = outTmp
        End If
    End Sub
    
    Private Sub Form_Load()
        Dim colorTmp As Long
        On Error Resume Next
        If Dir(App.Path & "\XYShowLabel.txt") = "" Then
            MsgBox "Please ADD a file named ""XYShowLabel.txt"".", 16, "ERROR"
            End
        End If
        Me.BackColor = RGB(0, 38, 0)
        SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, &H2 Or &H1
        Me.Caption = "Designer:Leisureeen"
        colorTmp = GetWindowLong(Me.hwnd, -20)
        colorTmp = colorTmp Or &H80000
        SetWindowLong Me.hwnd, -20, colorTmp
        SetLayeredWindowAttributes Me.hwnd, Me.BackColor, 38, 1
        Open App.Path & "\XYShowLabel.txt" For Input As #1
    End Sub
    
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
        Close
        End
    End Sub
  • 相关阅读:
    jquery操作select(取值,设置选中)
    js一点代码备用
    正则实现文本框只能输入16个数字,每4位数字后添加一个空格
    js限制文本框只能输入数字方法
    可编程数据平面将OpenFlow扩展至电信级应用(二)
    Android Camera解析(上) 调用系统相机拍摄照片
    结束QQ即时通信垄断,开辟即时通信互联互通instantnet时代
    KMP模板
    网络抓包工具 Fiddler
    STM32F030, 使用嘀嗒定时器Systick实现LED闪烁
  • 原文地址:https://www.cnblogs.com/leisureeen/p/12715675.html
Copyright © 2020-2023  润新知