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

📄 scribble.frm

📁 VB圣经
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmScribble 
   Caption         =   "LightWeight Scribble Sample"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   ClipControls    =   0   'False
   LinkTopic       =   "Form1"
   ScaleHeight     =   213
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   312
   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_PointMM As FixedSizeMemoryManager
Private m_StartingPoint As IStartingPoint
Private Const cPointsPerBlock As Long = 128

Private Sub Form_DblClick()
    Set m_StartingPoint = Nothing
    'Free memory for current points before creating
    'new points.  Note that by VB releases the original
    'm_PointMM after it gets the new one.  So, by releasing
    'first, the heap frees a large chunk of memory before we
    'try to grab a new one.  In practice, ObjPtr(m_PointMM) will
    'generally be the same before and after we recreate it!
    Set m_PointMM = Nothing
    'Recreate the memory manager
    Set m_PointMM = VBoost.CreateFixedSizeMemoryManager(cPointMemMgrSize, cPointsPerBlock)
    Refresh
End Sub

Private Sub Form_Load()
    Set m_PointMM = VBoost.CreateFixedSizeMemoryManager(cPointMemMgrSize, cPointsPerBlock)
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(m_PointMM, NewPoint(m_PointMM, 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(m_PointMM, 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

Private Sub Form_Unload(Cancel As Integer)
    'Release the starting point before m_PointMM
    'becuase m_PointMM owns the memory for the object.
    Set m_StartingPoint = Nothing
    Set m_PointMM = Nothing
End Sub

⌨️ 快捷键说明

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