home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- BorderStyle = 1 'Fixed Single
- Caption = "Clipboard Copy & Paste"
- ClientHeight = 4575
- ClientLeft = 1140
- ClientTop = 2010
- ClientWidth = 8775
- Height = 5265
- Left = 1080
- LinkTopic = "Form1"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4575
- ScaleWidth = 8775
- Top = 1380
- Width = 8895
- Begin VB.Frame Frame5
- Caption = "PicBuf Destination Selection"
- Height = 555
- Left = 5865
- TabIndex = 15
- Top = 3960
- Width = 2775
- Begin VB.OptionButton optSelectiondest
- Caption = "Selection"
- Height = 255
- Left = 1440
- TabIndex = 0
- Top = 240
- Width = 1215
- End
- Begin VB.OptionButton optSelectAlldest
- Caption = "All"
- Height = 255
- Left = 120
- TabIndex = 1
- Top = 240
- Value = -1 'True
- Width = 1215
- End
- End
- Begin VB.Frame Frame4
- Caption = "PicBuf Source Selection"
- Height = 555
- Left = 3000
- TabIndex = 12
- Top = 3960
- Width = 2775
- Begin VB.OptionButton optSelectAllsrc
- Caption = "All"
- Height = 255
- Left = 120
- TabIndex = 14
- Top = 240
- Value = -1 'True
- Width = 1215
- End
- Begin VB.OptionButton optSelectionsrc
- Caption = "Selection"
- Height = 255
- Left = 1440
- TabIndex = 13
- Top = 240
- Width = 1215
- End
- End
- Begin VB.Frame Frame3
- Caption = "PicBuf Destination"
- Height = 990
- Left = 5850
- TabIndex = 9
- Top = 2880
- Width = 2775
- Begin VB.CommandButton cmdPicBufdestPaste
- Caption = "Paste from clipboard"
- Height = 555
- Left = 1440
- TabIndex = 11
- Top = 240
- Width = 1215
- End
- Begin VB.CommandButton cmdPicBufdestCopy
- Caption = "Copy to clipboard"
- Height = 555
- Left = 120
- TabIndex = 10
- Top = 240
- Width = 1215
- End
- End
- Begin VB.Frame Frame2
- Caption = "PicBuf Source"
- Height = 990
- Left = 3000
- TabIndex = 5
- Top = 2880
- Width = 2775
- Begin VB.CommandButton cmdPicBufsrcCopy
- Caption = "Copy to clipboard"
- Height = 555
- Left = 120
- TabIndex = 7
- Top = 240
- Width = 1215
- End
- Begin VB.CommandButton cmdPicBufsrcPaste
- Caption = "Paste from clipboard"
- Height = 555
- Left = 1440
- TabIndex = 6
- Top = 240
- Width = 1215
- End
- End
- Begin VB.Frame Frame1
- Caption = "Picture Box"
- Height = 975
- Left = 120
- TabIndex = 2
- Top = 2880
- Width = 2775
- Begin VB.CommandButton cmdPicCopy
- Caption = "Copy to clipboard"
- Height = 540
- Left = 120
- TabIndex = 4
- Top = 240
- Width = 1215
- End
- Begin VB.CommandButton cmdPicPaste
- Caption = "Paste from clipboard"
- Height = 540
- Left = 1440
- TabIndex = 3
- Top = 240
- Width = 1215
- End
- End
- Begin VB.PictureBox Picture1
- Height = 2775
- Left = 120
- ScaleHeight = 2715
- ScaleWidth = 2715
- TabIndex = 8
- Top = 0
- Width = 2775
- End
- Begin ik32Lib.Picbuf PicbufDest
- Height = 2775
- Left = 5880
- TabIndex = 17
- Top = 0
- Width = 2775
- _Version = 65541
- _ExtentX = 4895
- _ExtentY = 4895
- _StockProps = 253
- End
- Begin ik32Lib.Picbuf PicbufSrc
- Height = 2775
- Left = 3000
- TabIndex = 16
- Top = 0
- Width = 2775
- _Version = 65541
- _ExtentX = 4895
- _ExtentY = 4895
- _StockProps = 253
- End
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 120
- Top = 3960
- _Version = 65536
- _ExtentX = 847
- _ExtentY = 847
- _StockProps = 0
- End
- Begin VB.Menu ikFile
- Caption = "File"
- Begin VB.Menu ikPictureBoxLoad
- Caption = "&Load to Picture Box"
- End
- Begin VB.Menu ikPicBufLoadsrc
- Caption = "Load to PicBuf &Source"
- End
- Begin VB.Menu ikPicBufLoaddest
- Caption = "Load to PicBuf &Destination"
- End
- Begin VB.Menu mnuSpacer
- Caption = "-"
- End
- Begin VB.Menu ikExit
- Caption = "Exit"
- Shortcut = ^X
- End
- End
- Begin VB.Menu mnuReload
- Caption = "&Reload"
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Dim strPicBoxFilename As String
- 'Description: This module determines which option
- 'button has been chosen, and then performs a copy,
- 'to the clipboard
- Private Sub cmdPicBufdestCopy_Click()
- On Error GoTo ImageError
- Dim i As Integer
- i = optSelectAlldest.Value
- Picbufdest.CopyClipboard i
- Exit Sub
- ImageError:
- If Err = 20306 Then
- MsgBox "To Copy an image to the clipboard, there must be an image loaded in the Picbuf control."
- End If
- End Sub
- 'Description: Here, the code decides which option
- 'button has been chosen, and then pastes to the
- 'clipboard accordingly
- Private Sub cmdPicBufdestPaste_Click()
- Dim i As Integer
- i = optSelectAlldest.Value
- Picbufdest.PasteClipboard i
- If optSelectionsrc.Value = True Then
- Picbufsrc.Rect
- End If
- If optSelectiondest.Value = True Then
- Picbufdest.Rect
- End If
- End Sub
- 'Description: This module determines which option
- 'button has been chosen, and then performs a copy,
- 'to the clipboard
- Private Sub cmdPicBufsrcCopy_Click()
- On Error GoTo ImageError
- Dim i As Integer
- i = optSelectAllsrc.Value
- Picbufsrc.CopyClipboard i
- Exit Sub
- ImageError:
- If Err = 20306 Then
- MsgBox "To Copy an image to the clipboard, there must be an image loaded in the Picbuf control."
- End If
- End Sub
- 'Description: Here, the code decides which option
- 'button has been chosen, and then pastes to the
- 'clipboard accordingly
- Private Sub cmdPicBufsrcPaste_Click()
- Dim i As Integer
- i = optSelectAllsrc.Value
- Picbufsrc.PasteClipboard i
- If optSelectionsrc.Value = True Then
- Picbufsrc.Rect
- End If
- If optSelectiondest.Value = True Then
- Picbufdest.Rect
- End If
- End Sub
- Private Sub cmdPicCopy_Click()
- Clipboard.SetData Picture1.Picture, vbCFDIB
- End Sub
- 'Description: Here, the code pastes to the picture
- 'control
- Private Sub cmdPicPaste_Click()
- Picture1.Picture = Clipboard.GetData(vbCFDIB)
- End Sub
- 'Description: This code sets properties for the
- 'Picbuf control
- Private Sub Form_Load()
- 'Set PicBuf options
- InitPicbuf Picbufsrc, True, "Marybeth.tif"
- InitPicbuf Picbufdest, True, "winlogo1.bmp"
- strPicBoxFilename = App.Path + "\..\images\bambi1.bmp"
- Picture1.Picture = LoadPicture(strPicBoxFilename)
- Picbufsrc.ForeColor = 255
- Picbufdest.ForeColor = 255
- SetSelect Picbufsrc, 0, 0, 100, 100
- SetSelect Picbufdest, 0, 0, 100, 100
- End Sub
- 'Description: This module simply uses the end
- 'command the exit the program
- Private Sub ikExit_Click()
- End Sub
- 'Description: When this menu option is chosen, a
- 'filename is determined using the Common Dialog
- 'Control. Then it is loaded into the Picbuf.
- Private Sub ikPicBufLoaddest_Click()
- 'Call code to use common dialog
- Call LoadImage(Picbufdest, CommonDialog1)
- End Sub
- 'Description: When this menu option is chosen, a
- 'filename is determined using the Common Dialog
- 'Control. Then it is loaded into the Picbuf.
- Private Sub ikPicBufLoadsrc_Click()
- 'Call code to use common dialog
- Call LoadImage(Picbufsrc, CommonDialog1)
- End Sub
- 'Description: Here, we use the Common Dialog Control
- 'to select an image file, and then load it with
- 'the Picture Control.
- Private Sub ikPictureBoxLoad_Click()
- CommonDialog1.Filter = "all files|*.*|BMP|*.bmp"
- CommonDialog1.FilterIndex = 2
- CommonDialog1.Action = 1
- If CommonDialog1.Filename <> "" Then
- strPicBoxFilename = CommonDialog1.Filename
- Picture1.Picture = LoadPicture(strPicBoxFilename)
- End If
- End Sub
- 'Description: This code reloads the images on
- 'the form
- Private Sub mnuReload_Click()
- Picture1.Picture = LoadPicture(strPicBoxFilename)
- Picbufsrc.Load
- Picbufdest.Load
- optSelectAllsrc.Value = True
- optSelectAlldest.Value = True
- End Sub
- 'Description: This code removes the box on the
- 'picbuf
- Private Sub optSelectAlldest_Click()
- Picbufdest.Refresh
- End Sub
- 'Description: This code removes the box on the
- 'picbuf
- Private Sub optSelectAllsrc_Click()
- Picbufsrc.Refresh
- End Sub
- 'Description: This code draws a box on the picbuf
- Private Sub optSelectiondest_Click()
- Picbufdest.Rect 1
- End Sub
- 'Description: This code draws a box on the picbuf
- Private Sub optSelectionsrc_Click()
- Picbufsrc.Rect 1
- End Sub
-