home *** CD-ROM | disk | FTP | other *** search
Visual Basic class definition | 2001-09-09 | 4.2 KB | 179 lines |
- VERSION 1.0 CLASS
- BEGIN
- MultiUse = -1 'True
- Persistable = 0 'NotPersistable
- DataBindingBehavior = 0 'vbNone
- DataSourceBehavior = 0 'vbNone
- MTSTransactionMode = 0 'NotAnMTSObject
- END
- Attribute VB_Name = "CPreview"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = False
- Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
- Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
- '-----------------------------------------------------------------------------
- ' This is a part of the BeeGrid ActiveX control.
- ' Copyright ⌐ 2000 Stinga
- ' All rights reserved.
- '
- ' You have a right to use and distribute the BeeGrid sample files in original
- ' form or modified, provided that you agree that Stinga has no warranty,
- ' obligations, or liability for any sample application files.
- '-----------------------------------------------------------------------------
- Option Explicit
-
- Implements ISGDevice
-
- Private mDest As PictureBox
- Private mPrintBeeGrid As PrintBeeGrid
-
- Private hdcmem As Long
- Private mhBitmap As Long
-
- Private msinTwipsPerPixelX As Single
- Private msinTwipsPerPixelY As Single
-
- Private Sub Class_Initialize()
- msinTwipsPerPixelX = Screen.TwipsPerPixelX
- msinTwipsPerPixelY = Screen.TwipsPerPixelY
- End Sub
-
- Private Sub Class_Terminate()
- DeleteMemBitmap
- Set mPrintBeeGrid = Nothing
- End Sub
-
- Private Sub CreateMemBitmap()
- Dim bm As BITMAP
- Dim rc As RECT, sinWidth!, sinHeight!
- Dim hBrush As Long
-
- DeleteMemBitmap
-
- sinWidth = mPrintBeeGrid.PrinterWidth / Screen.TwipsPerPixelX
- sinHeight = mPrintBeeGrid.PrinterHeight / Screen.TwipsPerPixelY
-
- hdcmem = CreateCompatibleDC(mDest.hdc)
- mhBitmap = CreateCompatibleBitmap(mDest.hdc, sinWidth, sinHeight)
-
- Call GetBmpObject(mhBitmap, 14, bm)
-
- SelectObject hdcmem, mhBitmap
-
- SetRect rc, 0, 0, sinWidth, sinHeight
-
- hBrush = CreateSolidBrush(QBColor(15))
-
- FillRect hdcmem, rc, hBrush
-
- DeleteObject hBrush
- End Sub
-
- Private Sub DeleteMemBitmap()
- If hdcmem <> 0 Then
- DeleteObject mhBitmap
- DeleteDC hdcmem
- End If
-
- End Sub
-
-
-
- Private Property Set ISGDevice_Destination(ByVal RHS As Object)
- Set mDest = RHS
- End Property
-
- Private Property Get ISGDevice_Destination() As Object
- Set ISGDevice_Destination = mDest
- End Property
-
-
-
-
-
-
- Private Property Get ISGDevice_hDC() As Long
- ISGDevice_hDC = hdcmem
- End Property
-
- Private Property Let ISGDevice_hDC(ByVal RHS As Long)
- hdcmem = RHS
- End Property
-
-
- Private Property Set ISGDevice_PrintGrid(ByVal RHS As PrintBeeGrid)
- Set mPrintBeeGrid = RHS
- End Property
-
- Private Property Get ISGDevice_PrintGrid() As PrintBeeGrid
- Set ISGDevice_PrintGrid = mPrintBeeGrid
- End Property
-
-
- Private Sub ISGDevice_Paint()
- Dim rc As RECT
- Dim sinWidth!, sinHeight!
- Dim sinDestWidth!, sinDestHeight!
- Dim hBrush As Long
-
- If mDest Is Nothing Then Exit Sub
-
- sinWidth = mPrintBeeGrid.PrinterWidth / Screen.TwipsPerPixelX
- sinHeight = mPrintBeeGrid.PrinterHeight / Screen.TwipsPerPixelY
-
- sinDestWidth = mDest.Width / Screen.TwipsPerPixelX
- sinDestHeight = mDest.Height / Screen.TwipsPerPixelY
-
- SetRect rc, 0, 0, sinDestWidth, sinDestHeight
-
- hBrush = CreateSolidBrush(QBColor(15))
-
- FillRect mDest.hdc, rc, hBrush
-
- DeleteObject hBrush
-
- If mDest.Tag = "ZOOM" Then
- StretchBlt mDest.hdc, 0, 0, sinDestWidth, sinDestHeight, _
- hdcmem, 0, 0, sinWidth, sinHeight, SRCCOPY
- Else
- BitBlt mDest.hdc, 0, 0, sinWidth, sinHeight, _
- hdcmem, 0, 0, SRCCOPY
- End If
- End Sub
-
- Private Sub ISGDevice_PrintReport()
-
- CreateMemBitmap
-
- mPrintBeeGrid.Printing hdcmem
- End Sub
-
- Private Property Let ISGDevice_ScaleMode(ByVal RHS As Integer)
-
- End Property
-
- Private Property Get ISGDevice_ScaleMode() As Integer
-
- End Property
-
-
-
-
-
-
-
- Private Property Get ISGDevice_TwipsPerPixelX() As Single
- ISGDevice_TwipsPerPixelX = msinTwipsPerPixelX
- End Property
-
-
-
-
- Private Property Get ISGDevice_TwipsPerPixelY() As Single
- ISGDevice_TwipsPerPixelY = msinTwipsPerPixelY
- End Property
-
-
-