home *** CD-ROM | disk | FTP | other *** search
Visual Basic class definition | 1999-04-24 | 6.3 KB | 247 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 = "BltSysCls"
- Attribute VB_GlobalNameSpace = True
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = True
- Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
- Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
- Private mvarhDC As Long 'local copy
- Private mvarBMP As Long
- Private mvarIsEmpty As Boolean 'local copy
- Private OldBMP As Long
- Private mvarTransparency As Boolean 'local copy
- Private ScreenWidth As Integer
- Private ScreenHeight As Integer
- Private ScreenX As Integer
- Private ScreenY As Integer
- Private mvarMaskBMP As Long 'local copy
- Private mvarMaskhDC As Long 'local copy
- Public TargetDC As Long
- Public NoAutoRedraw As Boolean
- Public Property Get ScrY() As Integer
- ScrY = ScreenY
- End Property
-
- Public Property Get MaskhDC() As Long
- 'used when retrieving value of a property, on the right side of an assignment.
- 'Syntax: Debug.Print X.MaskhDC
- MaskhDC = mvarMaskhDC
- End Property
-
-
-
- Public Property Get MaskBMP() As Long
- 'used when retrieving value of a property, on the right side of an assignment.
- 'Syntax: Debug.Print X.MaskBMP
- MaskBMP = mvarMaskBMP
- End Property
-
-
-
-
-
-
-
- Public Sub Redraw()
- Dim FrmDC As Long
- FrmDC = TargetDC
- 'OldBMP = SelectObject(PrevImghDC, PrevImgBMP)
- 'ret% = BitBlt(FrmDC, 400, 400, 100, 100, PrevImghDC, ScreenX, ScreenY, SRCCOPY)
- 'ret% = SelectObject(PrevImghDC, OldBMP)
- If mvarTransparency = False Then
- OldBMP = SelectObject(mvarhDC, mvarBMP)
- ret% = BitBlt(FrmDC, ScreenX, ScreenY, ScreenWidth, ScreenHeight, mvarhDC, 0, 0, SRCCOPY)
- OldBMP = SelectObject(mvarhDC, OldBMP)
- Else
- OldBMP = SelectObject(mvarMaskhDC, mvarMaskBMP)
- ret% = BitBlt(FrmDC, ScreenX, ScreenY, ScreenWidth, ScreenHeight, mvarMaskhDC, 0, 0, SRCAND)
- OldBMP = SelectObject(mvarMaskhDC, OldBMP)
- OldBMP = SelectObject(mvarhDC, mvarBMP)
- ret% = BitBlt(FrmDC, ScreenX, ScreenY, ScreenWidth, ScreenHeight, mvarhDC, 0, 0, SRCPAINT)
- OldBMP = SelectObject(mvarhDC, OldBMP)
- End If
- End Sub
-
- Public Function PastePicture(Optional ByVal X As Integer = 0, Optional ByVal y As Integer = 0) As Boolean
- OldBMP = SelectObject(mvarhDC, mvarBMP)
- ret% = BltSysMod.PastePicture(mvarhDC, 0, 0)
- OldBMP = SelectObject(mvarhDC, OldBMP)
- ScreenWidth = ClpBoard.Width
- ScreenHeight = ClpBoard.Height
- End Function
-
- Public Function PasteMaskPicture(Optional ByVal X As Integer = 0, Optional ByVal y As Integer = 0) As Boolean
- OldBMP = SelectObject(mvarMaskhDC, mvarMaskBMP)
- ret% = BltSysMod.PastePicture(mvarMaskhDC, 0, 0)
- OldBMP = SelectObject(mvarMaskhDC, OldBMP)
- ScreenWidth = ClpBoard.Width
- ScreenHeight = ClpBoard.Height
- End Function
-
-
-
- Public Function CopyMask(ByVal X As Integer, ByVal y As Integer, ByVal H As Integer, ByVal W As Integer) As Boolean
- CP = BltSysMod.CopyPicture(mvarMaskhDC, X, y, H, W)
- End Function
-
-
- Public Function CopyPicture(ByVal X As Integer, ByVal y As Integer, ByVal H As Integer, ByVal W As Integer) As Boolean
- CopyPicture = BltSysMod.CopyPicture(mvarhDC, X, y, H, W)
- End Function
-
-
- Public Sub Create(Hwnd As Long, DC As Long, W As Long, H As Long)
- mvarhDC = CreateCompatibleDC(GetDC(Hwnd))
- mvarBMP = CreateCompatibleBitmap(GetDC(Hwnd), W, H)
- mvarMaskhDC = CreateCompatibleDC(GetDC(Hwnd))
- mvarMaskBMP = CreateCompatibleBitmap(GetDC(Hwnd), W, H)
- 'PrevImghDC = CreateCompatibleDC(GetDC(Hwnd))
- 'PrevImgBMP = CreateCompatibleBitmap(GetDC(Hwnd), 800, 600)
- TargetDC = DC
- End Sub
- Public Property Let ScrX(vData As Integer)
- ScreenX = vData
- If NoAutoRedraw = False Then
- Redraw
- End If
- End Property
-
- Public Property Let ScrWidth(vData As Integer)
- ScreenWidth = vData
- If NoAutoRedraw = False Then
- Redraw
- End If
- End Property
- Public Property Let ScrHeight(vData As Integer)
- ScreenHeight = vData
- If NoAutoRedraw = False Then
- Redraw
- End If
- End Property
-
-
-
-
-
- Public Property Get ScrX() As Integer
- ScrX = ScreenX
- End Property
-
-
-
- Public Property Let ScrY(vData As Integer)
- ScreenY = vData
- If NoAutoRedraw = False Then
- Redraw
- End If
- End Property
-
-
- Public Property Get ScrHeight() As Integer
- ScrHeight = ScreenHeight
- End Property
-
- Public Property Get ScrWidth() As Integer
- ScrWidth = ScreenWidth
- End Property
-
-
-
- Public Sub SetPixel(X As Integer, y As Integer, RGBVal As Long)
- OldBMP = SelectObject(mvarhDC, mvarBMP)
- ret% = SystemSupport.SetPixel(mvarhDC, X, y, RGBVal)
- OldBMP = SelectObject(mvarhDC, OldBMP)
- End Sub
-
- Public Function ReadPixel(X As Integer, y As Integer) As Long
- OldBMP = SelectObject(mvarhDC, mvarBMP)
- ReadPixel = GetPixel(mvarhDC, X, y)
- OldBMP = SelectObject(mvarhDC, OldBMP)
- End Function
-
-
- Public Property Let Transparency(ByVal vData As Boolean)
- 'used when assigning a value to the property, on the left side of an assignment.
- 'Syntax: X.Transparency = 5
- mvarTransparency = vData
- End Property
-
-
-
- Public Property Get BMP() As Long
- 'used when retrieving value of a property, on the right side of an assignment.
- 'Syntax: Debug.Print X.BMP
- BMP = mvarBMP
- End Property
-
- Public Property Get Transparency() As Boolean
- 'used when retrieving value of a property, on the right side of an assignment.
- 'Syntax: Debug.Print X.Transparency
-
- Transparency = mvarTransparency
-
- End Property
-
-
-
-
- Public Property Get IsEmpty() As Boolean
- 'used when retrieving value of a property, on the right side of an assignment.
- 'Syntax: Debug.Print X.IsEmpty
- IsEmpty = mvarIsEmpty
- End Property
-
-
-
- Public Property Get hdc() As Long
- 'used when retrieving value of a property, on the right side of an assignment.
- 'Syntax: Debug.Print X.hDC
- hdc = mvarhDC
- End Property
-
-
-
- Private Sub Class_InitProperties()
-
- End Sub
-
-
- Private Sub Class_ReadProperties(PropBag As PropertyBag)
-
- End Sub
-
-
-
- Public Sub DestroyPicture()
- ret% = DeleteDC(mvarhDC)
- ret% = DeleteObject(mvarBMP)
- ret% = DeleteDC(mvarMaskhDC)
- re% = DeleteObject(mvarMaskBMP)
- End Sub
-
-
-
- Public Sub LoadPicture(filename As String)
- DirectLoad filename, mvarhDC, mvarBMP, ScreenWidth, ScreenHeight
- If NoAutoRedraw = False Then
- Redraw
- End If
- End Sub
-
- Public Sub LoadMask(filename As String)
- Dim W As Integer, H As Integer
- DirectLoad filename, mvarMaskhDC, mvarMaskBMP, W, H
- If NoAutoRedraw = False Then
- Redraw
- End If
- End Sub
-
-