home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 5 / MasteringVisualBasic5.iso / olympus / ik32_15t / vb4.shr / Cutpast.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-09-04  |  10.6 KB  |  341 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Clipboard Copy & Paste"
  5.    ClientHeight    =   4575
  6.    ClientLeft      =   1140
  7.    ClientTop       =   2010
  8.    ClientWidth     =   8775
  9.    Height          =   5265
  10.    Left            =   1080
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   4575
  16.    ScaleWidth      =   8775
  17.    Top             =   1380
  18.    Width           =   8895
  19.    Begin VB.Frame Frame5 
  20.       Caption         =   "PicBuf Destination Selection"
  21.       Height          =   555
  22.       Left            =   5865
  23.       TabIndex        =   15
  24.       Top             =   3960
  25.       Width           =   2775
  26.       Begin VB.OptionButton optSelectiondest 
  27.          Caption         =   "Selection"
  28.          Height          =   255
  29.          Left            =   1440
  30.          TabIndex        =   0
  31.          Top             =   240
  32.          Width           =   1215
  33.       End
  34.       Begin VB.OptionButton optSelectAlldest 
  35.          Caption         =   "All"
  36.          Height          =   255
  37.          Left            =   120
  38.          TabIndex        =   1
  39.          Top             =   240
  40.          Value           =   -1  'True
  41.          Width           =   1215
  42.       End
  43.    End
  44.    Begin VB.Frame Frame4 
  45.       Caption         =   "PicBuf Source Selection"
  46.       Height          =   555
  47.       Left            =   3000
  48.       TabIndex        =   12
  49.       Top             =   3960
  50.       Width           =   2775
  51.       Begin VB.OptionButton optSelectAllsrc 
  52.          Caption         =   "All"
  53.          Height          =   255
  54.          Left            =   120
  55.          TabIndex        =   14
  56.          Top             =   240
  57.          Value           =   -1  'True
  58.          Width           =   1215
  59.       End
  60.       Begin VB.OptionButton optSelectionsrc 
  61.          Caption         =   "Selection"
  62.          Height          =   255
  63.          Left            =   1440
  64.          TabIndex        =   13
  65.          Top             =   240
  66.          Width           =   1215
  67.       End
  68.    End
  69.    Begin VB.Frame Frame3 
  70.       Caption         =   "PicBuf Destination"
  71.       Height          =   990
  72.       Left            =   5850
  73.       TabIndex        =   9
  74.       Top             =   2880
  75.       Width           =   2775
  76.       Begin VB.CommandButton cmdPicBufdestPaste 
  77.          Caption         =   "Paste from clipboard"
  78.          Height          =   555
  79.          Left            =   1440
  80.          TabIndex        =   11
  81.          Top             =   240
  82.          Width           =   1215
  83.       End
  84.       Begin VB.CommandButton cmdPicBufdestCopy 
  85.          Caption         =   "Copy to clipboard"
  86.          Height          =   555
  87.          Left            =   120
  88.          TabIndex        =   10
  89.          Top             =   240
  90.          Width           =   1215
  91.       End
  92.    End
  93.    Begin VB.Frame Frame2 
  94.       Caption         =   "PicBuf Source"
  95.       Height          =   990
  96.       Left            =   3000
  97.       TabIndex        =   5
  98.       Top             =   2880
  99.       Width           =   2775
  100.       Begin VB.CommandButton cmdPicBufsrcCopy 
  101.          Caption         =   "Copy to clipboard"
  102.          Height          =   555
  103.          Left            =   120
  104.          TabIndex        =   7
  105.          Top             =   240
  106.          Width           =   1215
  107.       End
  108.       Begin VB.CommandButton cmdPicBufsrcPaste 
  109.          Caption         =   "Paste from clipboard"
  110.          Height          =   555
  111.          Left            =   1440
  112.          TabIndex        =   6
  113.          Top             =   240
  114.          Width           =   1215
  115.       End
  116.    End
  117.    Begin VB.Frame Frame1 
  118.       Caption         =   "Picture Box"
  119.       Height          =   975
  120.       Left            =   120
  121.       TabIndex        =   2
  122.       Top             =   2880
  123.       Width           =   2775
  124.       Begin VB.CommandButton cmdPicCopy 
  125.          Caption         =   "Copy to clipboard"
  126.          Height          =   540
  127.          Left            =   120
  128.          TabIndex        =   4
  129.          Top             =   240
  130.          Width           =   1215
  131.       End
  132.       Begin VB.CommandButton cmdPicPaste 
  133.          Caption         =   "Paste from clipboard"
  134.          Height          =   540
  135.          Left            =   1440
  136.          TabIndex        =   3
  137.          Top             =   240
  138.          Width           =   1215
  139.       End
  140.    End
  141.    Begin VB.PictureBox Picture1 
  142.       Height          =   2775
  143.       Left            =   120
  144.       ScaleHeight     =   2715
  145.       ScaleWidth      =   2715
  146.       TabIndex        =   8
  147.       Top             =   0
  148.       Width           =   2775
  149.    End
  150.    Begin ik32Lib.Picbuf PicbufDest 
  151.       Height          =   2775
  152.       Left            =   5880
  153.       TabIndex        =   17
  154.       Top             =   0
  155.       Width           =   2775
  156.       _Version        =   65541
  157.       _ExtentX        =   4895
  158.       _ExtentY        =   4895
  159.       _StockProps     =   253
  160.    End
  161.    Begin ik32Lib.Picbuf PicbufSrc 
  162.       Height          =   2775
  163.       Left            =   3000
  164.       TabIndex        =   16
  165.       Top             =   0
  166.       Width           =   2775
  167.       _Version        =   65541
  168.       _ExtentX        =   4895
  169.       _ExtentY        =   4895
  170.       _StockProps     =   253
  171.    End
  172.    Begin MSComDlg.CommonDialog CommonDialog1 
  173.       Left            =   120
  174.       Top             =   3960
  175.       _Version        =   65536
  176.       _ExtentX        =   847
  177.       _ExtentY        =   847
  178.       _StockProps     =   0
  179.    End
  180.    Begin VB.Menu ikFile 
  181.       Caption         =   "File"
  182.       Begin VB.Menu ikPictureBoxLoad 
  183.          Caption         =   "&Load to Picture Box"
  184.       End
  185.       Begin VB.Menu ikPicBufLoadsrc 
  186.          Caption         =   "Load to PicBuf &Source"
  187.       End
  188.       Begin VB.Menu ikPicBufLoaddest 
  189.          Caption         =   "Load to PicBuf &Destination"
  190.       End
  191.       Begin VB.Menu mnuSpacer 
  192.          Caption         =   "-"
  193.       End
  194.       Begin VB.Menu ikExit 
  195.          Caption         =   "Exit"
  196.          Shortcut        =   ^X
  197.       End
  198.    End
  199.    Begin VB.Menu mnuReload 
  200.       Caption         =   "&Reload"
  201.    End
  202. Attribute VB_Name = "Form1"
  203. Attribute VB_Creatable = False
  204. Attribute VB_Exposed = False
  205. Option Explicit
  206. Dim strPicBoxFilename As String
  207. 'Description: This module determines which option
  208. 'button has been chosen, and then performs a copy,
  209. 'to the clipboard
  210. Private Sub cmdPicBufdestCopy_Click()
  211. On Error GoTo ImageError
  212.     Dim i As Integer
  213.     i = optSelectAlldest.Value
  214.     Picbufdest.CopyClipboard i
  215. Exit Sub
  216. ImageError:
  217. If Err = 20306 Then
  218.     MsgBox "To Copy an image to the clipboard, there must be an image loaded in the Picbuf control."
  219. End If
  220. End Sub
  221. 'Description: Here, the code decides which option
  222. 'button has been chosen, and then pastes to the
  223. 'clipboard accordingly
  224. Private Sub cmdPicBufdestPaste_Click()
  225.     Dim i As Integer
  226.     i = optSelectAlldest.Value
  227.     Picbufdest.PasteClipboard i
  228.     If optSelectionsrc.Value = True Then
  229.         Picbufsrc.Rect
  230.     End If
  231.     If optSelectiondest.Value = True Then
  232.         Picbufdest.Rect
  233.     End If
  234. End Sub
  235. 'Description: This module determines which option
  236. 'button has been chosen, and then performs a copy,
  237. 'to the clipboard
  238. Private Sub cmdPicBufsrcCopy_Click()
  239. On Error GoTo ImageError
  240.     Dim i As Integer
  241.     i = optSelectAllsrc.Value
  242.     Picbufsrc.CopyClipboard i
  243. Exit Sub
  244. ImageError:
  245. If Err = 20306 Then
  246.     MsgBox "To Copy an image to the clipboard, there must be an image loaded in the Picbuf control."
  247. End If
  248. End Sub
  249. 'Description: Here, the code decides which option
  250. 'button has been chosen, and then pastes to the
  251. 'clipboard accordingly
  252. Private Sub cmdPicBufsrcPaste_Click()
  253.     Dim i As Integer
  254.     i = optSelectAllsrc.Value
  255.     Picbufsrc.PasteClipboard i
  256.     If optSelectionsrc.Value = True Then
  257.         Picbufsrc.Rect
  258.     End If
  259.     If optSelectiondest.Value = True Then
  260.         Picbufdest.Rect
  261.     End If
  262. End Sub
  263. Private Sub cmdPicCopy_Click()
  264. Clipboard.SetData Picture1.Picture, vbCFDIB
  265. End Sub
  266. 'Description: Here, the code pastes to the picture
  267. 'control
  268. Private Sub cmdPicPaste_Click()
  269.     Picture1.Picture = Clipboard.GetData(vbCFDIB)
  270. End Sub
  271. 'Description: This code sets properties for the
  272. 'Picbuf control
  273. Private Sub Form_Load()
  274.     'Set PicBuf options
  275.     InitPicbuf Picbufsrc, True, "Marybeth.tif"
  276.     InitPicbuf Picbufdest, True, "winlogo1.bmp"
  277.     strPicBoxFilename = App.Path + "\..\images\bambi1.bmp"
  278.     Picture1.Picture = LoadPicture(strPicBoxFilename)
  279.     Picbufsrc.ForeColor = 255
  280.     Picbufdest.ForeColor = 255
  281.     SetSelect Picbufsrc, 0, 0, 100, 100
  282.     SetSelect Picbufdest, 0, 0, 100, 100
  283. End Sub
  284. 'Description: This module simply uses the end
  285. 'command the exit the program
  286. Private Sub ikExit_Click()
  287. End Sub
  288. 'Description: When this menu option is chosen, a
  289. 'filename is determined using the Common Dialog
  290. 'Control. Then it is loaded into the Picbuf.
  291. Private Sub ikPicBufLoaddest_Click()
  292. 'Call code to use common dialog
  293. Call LoadImage(Picbufdest, CommonDialog1)
  294. End Sub
  295. 'Description: When this menu option is chosen, a
  296. 'filename is determined using the Common Dialog
  297. 'Control. Then it is loaded into the Picbuf.
  298. Private Sub ikPicBufLoadsrc_Click()
  299. 'Call code to use common dialog
  300. Call LoadImage(Picbufsrc, CommonDialog1)
  301. End Sub
  302. 'Description: Here, we use the Common Dialog Control
  303. 'to select an image file, and then load it with
  304. 'the Picture Control.
  305. Private Sub ikPictureBoxLoad_Click()
  306. CommonDialog1.Filter = "all files|*.*|BMP|*.bmp"
  307. CommonDialog1.FilterIndex = 2
  308. CommonDialog1.Action = 1
  309. If CommonDialog1.Filename <> "" Then
  310.     strPicBoxFilename = CommonDialog1.Filename
  311.     Picture1.Picture = LoadPicture(strPicBoxFilename)
  312. End If
  313. End Sub
  314. 'Description: This code reloads the images on
  315. 'the form
  316. Private Sub mnuReload_Click()
  317.     Picture1.Picture = LoadPicture(strPicBoxFilename)
  318.     Picbufsrc.Load
  319.     Picbufdest.Load
  320.     optSelectAllsrc.Value = True
  321.     optSelectAlldest.Value = True
  322. End Sub
  323. 'Description: This code removes the box on the
  324. 'picbuf
  325. Private Sub optSelectAlldest_Click()
  326. Picbufdest.Refresh
  327. End Sub
  328. 'Description: This code removes the box on the
  329. 'picbuf
  330. Private Sub optSelectAllsrc_Click()
  331. Picbufsrc.Refresh
  332. End Sub
  333. 'Description: This code draws a box on the picbuf
  334. Private Sub optSelectiondest_Click()
  335. Picbufdest.Rect 1
  336. End Sub
  337. 'Description: This code draws a box on the picbuf
  338. Private Sub optSelectionsrc_Click()
  339. Picbufsrc.Rect 1
  340. End Sub
  341.