home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form CopyPixForm
- Caption = "Pixel Copy"
- ClientHeight = 6390
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 6615
- LinkTopic = "Form1"
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 6390
- ScaleWidth = 6615
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton Command2
- Caption = "Copy API"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 4680
- TabIndex = 3
- Top = 5880
- Width = 1815
- End
- Begin VB.PictureBox Picture2
- Height = 3015
- Left = 120
- ScaleHeight = 197
- ScaleMode = 3 'Pixel
- ScaleWidth = 285
- TabIndex = 2
- Top = 3240
- Width = 4335
- End
- Begin VB.CommandButton Command1
- Caption = "Copy VB"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 4680
- TabIndex = 1
- Top = 5280
- Width = 1815
- End
- Begin VB.PictureBox Picture1
- Height = 3015
- Left = 120
- Picture = "CopyPixForm.frx":0000
- ScaleHeight = 197
- ScaleMode = 3 'Pixel
- ScaleWidth = 285
- TabIndex = 0
- Top = 120
- Width = 4335
- End
- Attribute VB_Name = "CopyPixForm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
- Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
- Private Declare Function GetNearestColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long
- Private Sub Command1_Click()
- Dim i As Integer, j As Integer
- Dim clrValue As Long
- Picture2.Cls
- For i = 0 To Picture1.ScaleWidth - 1
- For j = 0 To Picture1.ScaleHeight - 1
- clrValue = Picture1.Point(i, j)
- Picture2.PSet (i, j), clrValue
- Next
- 'DoEvents
- Next
- End Sub
- Private Sub Command2_Click()
- Dim i As Integer, j As Integer
- Dim clrValue As Long
- For i = 0 To Picture1.ScaleWidth - 1
- For j = 0 To Picture1.ScaleHeight - 1
- SetPixel Picture2.hdc, i, j, GetPixel(Picture1.hdc, i, j)
- Next
- Next
- End Sub
- Private Sub Form_Load()
- Picture2.Picture = Picture1.Picture
- End Sub
-