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

📄 scroll.frm

📁 利用vb来实现显示滚动的字
💻 FRM
字号:
VERSION 2.00
Begin Form frmMain 
   BackColor       =   &H8000000F&
   Caption         =   "Scrolling sample"
   ClientHeight    =   3840
   ClientLeft      =   1095
   ClientTop       =   1485
   ClientWidth     =   8325
   Height          =   4245
   Left            =   1035
   LinkTopic       =   "Form1"
   ScaleHeight     =   3840
   ScaleWidth      =   8325
   Top             =   1140
   Width           =   8445
   Begin HScrollBar HScroll1 
      Height          =   240
      LargeChange     =   5
      Left            =   120
      TabIndex        =   6
      Top             =   2640
      Width           =   5295
   End
   Begin VScrollBar VScroll1 
      Height          =   1935
      LargeChange     =   5
      Left            =   5400
      TabIndex        =   5
      Top             =   720
      Width           =   255
   End
   Begin PictureBox Picture1 
      Height          =   1935
      Left            =   120
      ScaleHeight     =   1905
      ScaleWidth      =   5265
      TabIndex        =   3
      Top             =   720
      Width           =   5295
      Begin PictureBox picScroller 
         AutoSize        =   -1  'True
         Height          =   1935
         Left            =   -15
         ScaleHeight     =   1905
         ScaleWidth      =   5265
         TabIndex        =   4
         Top             =   -15
         Width           =   5295
      End
   End
   Begin CommonDialog File 
      DefaultExt      =   "BMP"
      DialogTitle     =   "OPen BMP to scroll"
      Filter          =   "Windows Bitmaps (*.bmp)|*.bmp|All files (*.*)|*.*"
      Left            =   0
      Top             =   2280
   End
   Begin CommandButton cmdLoad 
      Caption         =   "Load Picture"
      Height          =   495
      Left            =   2880
      TabIndex        =   2
      Top             =   120
      Width           =   2655
   End
   Begin CommandButton cmdScrollText 
      Caption         =   "Scroll Text"
      Height          =   495
      Left            =   120
      TabIndex        =   1
      Top             =   120
      Width           =   2655
   End
   Begin Timer Timer1 
      Enabled         =   0   'False
      Interval        =   50
      Left            =   360
      Top             =   2280
   End
   Begin Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H8000000F&
      Caption         =   "This is as smooth as it gets"
      FontBold        =   -1  'True
      FontItalic      =   0   'False
      FontName        =   "MS Sans Serif"
      FontSize        =   30
      FontStrikethru  =   0   'False
      FontUnderline   =   0   'False
      Height          =   690
      Left            =   480
      TabIndex        =   0
      Top             =   3000
      Width           =   7650
   End
End
Option Explicit

Sub cmdLoad_Click ()

   ' Trap errors
   On Error Resume Next
   ' Generate error when user presses Cancel
   File.CancelError = True
   ' Show dialog
   File.Action = 1
   ' Load picture if no error occured
   If Err = 0 Then
      picScroller = LoadPicture(File.Filename)
      VScroll1.Max = picScroller.Height / Screen.TwipsPerPixelY
      HScroll1.Max = picScroller.Width / Screen.TwipsPerPixelX
   End If

End Sub

Sub cmdScrollText_Click ()

   Timer1.Enabled = Not Timer1.Enabled
   If cmdScrollText.Caption = "Scroll Text" Then
      cmdScrollText.Caption = "Stopp scrolling"
   Else
      cmdScrollText.Caption = "Scroll Text"
   End If

End Sub

Sub HScroll1_Change ()

   picScroller.Left = -(HScroll1.Value) * Screen.TwipsPerPixelX

End Sub

Sub Timer1_Timer ()

   Label1.Left = Label1.Left - 15

   If Label1.Left = -Label1.Width Then Label1.Left = Width

End Sub

Sub VScroll1_Change ()

   picScroller.Top = -(VScroll1.Value) * Screen.TwipsPerPixelY
   
End Sub

⌨️ 快捷键说明

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