scribble.frm

来自「此源码为vb圣经编码」· FRM 代码 · 共 83 行

FRM
83
字号
VERSION 5.00
Begin VB.Form frmScribble 
   Caption         =   "LightWeight Scribble Sample (Compactible)"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5175
   ClipControls    =   0   'False
   LinkTopic       =   "Form1"
   ScaleHeight     =   213
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   345
   StartUpPosition =   3  'Windows Default
End
Attribute VB_Name = "frmScribble"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'***************************************************************
' (c) Copyright 2000 Matthew J. Curland
'
' This file is from the CD-ROM accompanying the book:
' Advanced Visual Basic 6: Power Techniques for Everyday Programs
'   Author: Matthew Curland
'   Published by: Addison-Wesley, July 2000
'   ISBN: 0-201-70712-8
'   http://www.PowerVB.com
'***************************************************************
Option Explicit
Private m_StartingPoint As IStartingPoint

Private Sub Form_DblClick()
    Set m_StartingPoint = Nothing
    Refresh
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbLeftButton Then
        CurrentX = X
        CurrentY = Y
        Set m_StartingPoint = NewStartingPoint(NewPoint(X, Y), m_StartingPoint)
    End If
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbLeftButton Then
        If Not m_StartingPoint Is Nothing Then
            Line -(X, Y)
            m_StartingPoint.AddPoint NewPoint(X, Y)
        End If
    End If
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbLeftButton Then
        If Not m_StartingPoint Is Nothing Then
            PSet (X, Y)
        End If
    End If
End Sub

Private Sub Form_Paint()
Dim pCurStart As IStartingPoint
Dim pCur As ILinkedPoint
Dim pCurNext As ILinkedPoint
    Set pCurStart = m_StartingPoint
    Do Until pCurStart Is Nothing
        Set pCur = pCurStart.First
        CurrentX = pCur.X
        CurrentY = pCur.Y
        Set pCurNext = pCur.Next
        Do Until pCurNext Is Nothing
            Set pCur = pCurNext
            Line -(pCur.X, pCur.Y)
            Set pCurNext = pCur.Next
        Loop
        PSet (pCur.X, pCur.Y)
        Set pCurStart = pCurStart.Next
    Loop
End Sub

⌨️ 快捷键说明

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