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

📄 frmqb.frm

📁 Visual Basic 6 大学教程的代码
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmQBColor 
   BackColor       =   &H00FFFFFF&
   Caption         =   "Fig. 11.28: Using the UpDown Control"
   ClientHeight    =   3885
   ClientLeft      =   2865
   ClientTop       =   1950
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3885
   ScaleWidth      =   4680
   Begin VB.TextBox txtSpeed 
      Enabled         =   0   'False
      Height          =   285
      Left            =   3720
      TabIndex        =   0
      Top             =   3480
      Width           =   735
   End
   Begin VB.Timer tmrTimer 
      Interval        =   500
      Left            =   1800
      Top             =   1320
   End
   Begin MSComCtl2.UpDown updSpeed 
      Height          =   255
      Left            =   3240
      TabIndex        =   1
      Top             =   2280
      Width           =   240
      _ExtentX        =   423
      _ExtentY        =   450
      _Version        =   393216
      Enabled         =   -1  'True
   End
End
Attribute VB_Name = "frmQBColor"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 11.28
' Demonstrating the UpDown Control
Option Explicit

Private Sub Form_Load()
   txtSpeed.Text = tmrTimer.Interval
   
   With updSpeed
      ' Make txtSpeed the buddy control
      .BuddyControl = txtSpeed
      
      .Min = 0       ' Minimum value
      .Max = 1000    ' Maximum value
      .Wrap = True   ' When min is exceeded wrap to 1000
                     ' and when max is exceeded wrap to 0

      .Increment = 100  ' Increment/decrement amount
   End With
      
End Sub

Private Sub DrawShape()
   Dim x As Single, y As Single
   Dim totalRadians As Single, r As Single
   Dim a As Single, theta As Single
   
   Call Randomize
   Scale (3, -3)-(-3, 3)         ' Change scale
   totalRadians = 8 * Atn(1)     ' Circle in Radians
   
   ForeColor = QBColor(Rnd() * 15)
   
   a = 3 * Rnd()  ' Offset used in equation
      
   For theta = 0 To totalRadians Step 0.01
      r = a * Sin(10 * theta) ' Multi-Leaved Rose
      x = r * Cos(theta)      ' y coordinate
      y = r * Sin(theta)      ' x coordinate
      PSet (x, y)             ' Turn pixel on
   Next theta
   
End Sub

Private Sub tmrTimer_Timer()
   Call DrawShape   ' Call when time interval expires
End Sub

Private Sub updSpeed_Change()

   ' Get UpDown control's value as it is changed
   ' and assign to Timer's Interval property and
   ' TextBox's Text property
   tmrTimer.Interval = updSpeed.Value
   txtSpeed.Text = updSpeed.Value
End Sub

⌨️ 快捷键说明

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