home *** CD-ROM | disk | FTP | other *** search
/ Soft 19 / Soft19.iso / win95-rc / win95_07.cab / imgsamp.frm (.txt) < prev    next >
Visual Basic Form  |  1996-04-22  |  42KB  |  1,336 lines

  1. VERSION 4.00
  2. Begin VB.Form frmSample 
  3.    Caption         =   "Image Edit"
  4.    ClientHeight    =   4155
  5.    ClientLeft      =   1560
  6.    ClientTop       =   1770
  7.    ClientWidth     =   6660
  8.    DrawStyle       =   5  'Transparent
  9.    Height          =   4845
  10.    Left            =   1500
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    ScaleHeight     =   4155
  14.    ScaleWidth      =   6660
  15.    Top             =   1140
  16.    Width           =   6780
  17.    Begin ImgeditLibCtl.ImgEdit oleImgEdit1 
  18.       Height          =   4092
  19.       Left            =   0
  20.       TabIndex        =   1
  21.       Top             =   0
  22.       Width           =   6612
  23.       _Version        =   65536
  24.       _ExtentX        =   11663
  25.       _ExtentY        =   7218
  26.       _StockProps     =   0
  27.       ImageControl    =   "ImgEdit1"
  28.    End
  29.    Begin ThumbnailLibCtl.ImgThumbnail oleImgThumbnail1 
  30.       Height          =   324
  31.       Left            =   0
  32.       TabIndex        =   0
  33.       Top             =   0
  34.       Visible         =   0   'False
  35.       Width           =   6612
  36.       _Version        =   65536
  37.       _ExtentX        =   11663
  38.       _ExtentY        =   572
  39.       _StockProps     =   0
  40.       BackColor       =   -2147483638
  41.       BeginProperty ThumbCaptionFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  42.          name            =   "Times New Roman"
  43.          charset         =   0
  44.          weight          =   400
  45.          size            =   12
  46.          underline       =   0   'False
  47.          italic          =   0   'False
  48.          strikethrough   =   0   'False
  49.       EndProperty
  50.    End
  51.    Begin AdminLibCtl.ImgAdmin oleImgAdmin1 
  52.       Left            =   3600
  53.       Top             =   735
  54.       _Version        =   65536
  55.       _ExtentX        =   4895
  56.       _ExtentY        =   397
  57.       _StockProps     =   0
  58.    End
  59.    Begin VB.Menu mnuFile 
  60.       Caption         =   "&File"
  61.       Begin VB.Menu mnuNew 
  62.          Caption         =   "&New"
  63.       End
  64.       Begin VB.Menu mnuOpen 
  65.          Caption         =   "&Open..."
  66.       End
  67.       Begin VB.Menu mnuSave 
  68.          Caption         =   "&Save"
  69.          Enabled         =   0   'False
  70.       End
  71.       Begin VB.Menu mnuSaveAs 
  72.          Caption         =   "Save &As..."
  73.          Enabled         =   0   'False
  74.       End
  75.       Begin VB.Menu mnuSep2 
  76.          Caption         =   "-"
  77.       End
  78.       Begin VB.Menu mnuPrint 
  79.          Caption         =   "&Print..."
  80.          Enabled         =   0   'False
  81.       End
  82.       Begin VB.Menu mnuSend 
  83.          Caption         =   "&Send..."
  84.          Enabled         =   0   'False
  85.       End
  86.       Begin VB.Menu mnuSep3 
  87.          Caption         =   "-"
  88.       End
  89.       Begin VB.Menu mnuExit 
  90.          Caption         =   "E&xit"
  91.       End
  92.    End
  93.    Begin VB.Menu mnuEdit 
  94.       Caption         =   "&Edit"
  95.       Enabled         =   0   'False
  96.       Begin VB.Menu mnuCut 
  97.          Caption         =   "Cu&t"
  98.       End
  99.       Begin VB.Menu mnuCopy 
  100.          Caption         =   "&Copy"
  101.       End
  102.       Begin VB.Menu mnuCopyPage 
  103.          Caption         =   "Cop&y Page"
  104.          Enabled         =   0   'False
  105.       End
  106.       Begin VB.Menu mnuPaste 
  107.          Caption         =   "&Paste"
  108.       End
  109.       Begin VB.Menu mnuDeletePage 
  110.          Caption         =   "&Delete Page"
  111.          Enabled         =   0   'False
  112.       End
  113.       Begin VB.Menu mnuSep4 
  114.          Caption         =   "-"
  115.       End
  116.       Begin VB.Menu mnuSelect 
  117.          Caption         =   "&Select"
  118.          Checked         =   -1  'True
  119.       End
  120.       Begin VB.Menu mnuDrag 
  121.          Caption         =   "&Drag"
  122.          Enabled         =   0   'False
  123.       End
  124.    End
  125.    Begin VB.Menu mnuView 
  126.       Caption         =   "&View"
  127.       Enabled         =   0   'False
  128.       Begin VB.Menu mnuScaleToGray 
  129.          Caption         =   "Scale to &Gray"
  130.       End
  131.       Begin VB.Menu mnuSep12 
  132.          Caption         =   "-"
  133.       End
  134.       Begin VB.Menu mnuOnePage 
  135.          Caption         =   "&One Page"
  136.          Checked         =   -1  'True
  137.       End
  138.       Begin VB.Menu mnuThumbnail 
  139.          Caption         =   "&Thumbnail"
  140.       End
  141.       Begin VB.Menu mnuPageThumbnail 
  142.          Caption         =   "&Page and Thumbnail"
  143.       End
  144.       Begin VB.Menu mnuSep7 
  145.          Caption         =   "-"
  146.       End
  147.       Begin VB.Menu mnuFullScreen 
  148.          Caption         =   "&Full Screen"
  149.       End
  150.       Begin VB.Menu mnuSep6 
  151.          Caption         =   "-"
  152.       End
  153.       Begin VB.Menu mnuToolbar 
  154.          Caption         =   "&Toolbar"
  155.          Enabled         =   0   'False
  156.       End
  157.       Begin VB.Menu mnuSep5 
  158.          Caption         =   "-"
  159.       End
  160.       Begin VB.Menu mnuOptions 
  161.          Caption         =   "Options..."
  162.          Enabled         =   0   'False
  163.       End
  164.    End
  165.    Begin VB.Menu mnuPage 
  166.       Caption         =   "&Page"
  167.       Enabled         =   0   'False
  168.       Begin VB.Menu mnuNext 
  169.          Caption         =   "&Next"
  170.       End
  171.       Begin VB.Menu mnuPrevious 
  172.          Caption         =   "&Previous"
  173.       End
  174.       Begin VB.Menu mnuFirst 
  175.          Caption         =   "&First"
  176.       End
  177.       Begin VB.Menu mnuLast 
  178.          Caption         =   "&Last"
  179.       End
  180.       Begin VB.Menu mnuSep11 
  181.          Caption         =   "-"
  182.       End
  183.       Begin VB.Menu mnuGoTo 
  184.          Caption         =   "&Go To..."
  185.       End
  186.       Begin VB.Menu mnuBack 
  187.          Caption         =   "Go &Back"
  188.       End
  189.       Begin VB.Menu mnuSep10 
  190.          Caption         =   "-"
  191.       End
  192.       Begin VB.Menu mnuPrintPage 
  193.          Caption         =   "Prin&t Page"
  194.       End
  195.       Begin VB.Menu mnuSep9 
  196.          Caption         =   "-"
  197.       End
  198.       Begin VB.Menu mnuLeft 
  199.          Caption         =   "Rotate &Left"
  200.       End
  201.       Begin VB.Menu mnuRight 
  202.          Caption         =   "Rotate &Right"
  203.       End
  204.       Begin VB.Menu mnuFlip 
  205.          Caption         =   "&Flip"
  206.       End
  207.       Begin VB.Menu mnuSep8 
  208.          Caption         =   "-"
  209.       End
  210.       Begin VB.Menu mnuInsert 
  211.          Caption         =   "&Insert..."
  212.          Enabled         =   0   'False
  213.       End
  214.       Begin VB.Menu mnuAppend 
  215.          Caption         =   "&Append..."
  216.          Enabled         =   0   'False
  217.       End
  218.       Begin VB.Menu mnuSep 
  219.          Caption         =   "-"
  220.       End
  221.       Begin VB.Menu mnuConvert 
  222.          Caption         =   "&Convert..."
  223.          Enabled         =   0   'False
  224.       End
  225.       Begin VB.Menu mnuRescan 
  226.          Caption         =   "&Rescan"
  227.          Enabled         =   0   'False
  228.       End
  229.    End
  230.    Begin VB.Menu mnuZoom 
  231.       Caption         =   "&Zoom"
  232.       Enabled         =   0   'False
  233.       Begin VB.Menu mnuZoomIn 
  234.          Caption         =   "Zoom &In"
  235.       End
  236.       Begin VB.Menu mnuZoomOut 
  237.          Caption         =   "Zoom &Out"
  238.       End
  239.       Begin VB.Menu mnuZoomToSelection 
  240.          Caption         =   "Zoom to &Selection"
  241.       End
  242.       Begin VB.Menu mnuSep13 
  243.          Caption         =   "-"
  244.       End
  245.       Begin VB.Menu mnuFitHeight 
  246.          Caption         =   "Fit to &Height"
  247.       End
  248.       Begin VB.Menu mnuFitWidth 
  249.          Caption         =   "Fit to &Width"
  250.       End
  251.       Begin VB.Menu mnuBestFit 
  252.          Caption         =   "&Best Fit"
  253.       End
  254.       Begin VB.Menu mnuActual 
  255.          Caption         =   "Act&ual Size"
  256.       End
  257.       Begin VB.Menu mnuSep14 
  258.          Caption         =   "-"
  259.       End
  260.       Begin VB.Menu mnu25 
  261.          Caption         =   "&25%"
  262.       End
  263.       Begin VB.Menu mnu50 
  264.          Caption         =   "&50%"
  265.       End
  266.       Begin VB.Menu mnu75 
  267.          Caption         =   "&75%"
  268.       End
  269.       Begin VB.Menu mnu100 
  270.          Caption         =   "&100%"
  271.       End
  272.       Begin VB.Menu mnu200 
  273.          Caption         =   "2&00%"
  274.       End
  275.       Begin VB.Menu mnu400 
  276.          Caption         =   "&400%"
  277.       End
  278.       Begin VB.Menu mnuCustom 
  279.          Caption         =   "&Custom..."
  280.          Enabled         =   0   'False
  281.       End
  282.    End
  283.    Begin VB.Menu mnuAnnotation 
  284.       Caption         =   "&Annotation"
  285.       Enabled         =   0   'False
  286.       Begin VB.Menu mnuHideAnnotation 
  287.          Caption         =   "&Hide Annotation"
  288.       End
  289.       Begin VB.Menu mnuBurnIn 
  290.          Caption         =   "B&urn in Annotation"
  291.       End
  292.       Begin VB.Menu mnuSep15 
  293.          Caption         =   "-"
  294.       End
  295.       Begin VB.Menu mnuNoTool 
  296.          Caption         =   "&No Tool"
  297.       End
  298.       Begin VB.Menu mnuSelectPointer 
  299.          Caption         =   "Selection &Pointer"
  300.       End
  301.       Begin VB.Menu mnuFreeHand 
  302.          Caption         =   "&Freehand Line"
  303.       End
  304.       Begin VB.Menu mnuHiLight 
  305.          Caption         =   "H&ighlight Line"
  306.       End
  307.       Begin VB.Menu mnuStraightLine 
  308.          Caption         =   "Straight &Line"
  309.       End
  310.       Begin VB.Menu mnuHollowRect 
  311.          Caption         =   "Hollow &Rectangle"
  312.       End
  313.       Begin VB.Menu mnuFillRect 
  314.          Caption         =   "Filled Rectan&gle"
  315.       End
  316.       Begin VB.Menu mnuTypedText 
  317.          Caption         =   "Typed Text"
  318.       End
  319.       Begin VB.Menu mnuAttachNote 
  320.          Caption         =   "Atta&ch-a-note"
  321.       End
  322.       Begin VB.Menu mnuTextFromFile 
  323.          Caption         =   "Te&xt from File"
  324.       End
  325.       Begin VB.Menu mnuStamp 
  326.          Caption         =   "Ru&bber Stamps"
  327.       End
  328.       Begin VB.Menu mnuSep16 
  329.          Caption         =   "-"
  330.       End
  331.       Begin VB.Menu mnuShowTools 
  332.          Caption         =   "Show Toolbox"
  333.       End
  334.    End
  335.    Begin VB.Menu mnuHelp 
  336.       Caption         =   "&Help"
  337.       Enabled         =   0   'False
  338.       Begin VB.Menu mnuAbout 
  339.          Caption         =   "&About..."
  340.          Enabled         =   0   'False
  341.       End
  342.    End
  343. Attribute VB_Name = "frmSample"
  344. Attribute VB_Creatable = False
  345. Attribute VB_Exposed = False
  346. ' ------------------------------------------------------------------------
  347. '               Copyright (C) 1995 Wang
  348. ' You have a royalty-free right to use, modify, reproduce and distribute
  349. ' the Sample Application Files (and/or any modified version) in any way
  350. ' you find useful, provided that you agree that Wang has no warranty,
  351. ' obligations or liability for any Sample Application Files.
  352. ' This application is intended as an example of how to use the Wang
  353. ' Imaging OLE Controls.  As such, we have kept refinements such as
  354. ' disabling and enabling menu items, elaborate error handling, etc. to
  355. ' a minimum so as not to obscure the code that actually deals with the
  356. ' Wang Imaging OLE controls.  There are items on the menus that have
  357. ' not been implemented.  These items, in general, would involve creating
  358. ' dialog boxes and other UI that are best left to the user.  Once the user
  359. ' has an understanding of how to use the Wang Imaging Controls, these
  360. ' items should be fairly simple to implement.
  361. ' ------------------------------------------------------------------------
  362. Dim Selection As Boolean 'Selection = True, selection rect drawn.
  363. Dim Annot8Visible As Boolean 'Annot8Visible = True, annotation toolbox is
  364.                             'visible
  365. Dim CurrentPage As Integer 'CurPage = currently displayed image page
  366. Dim LastPage As Integer 'LastPage = last page viewed before current page
  367. Dim TotalPages As Integer 'TotalPages = image document page count
  368. Dim numbits As Integer 'number of bits per pixel supported by this device
  369. 'Const defines
  370. Const NoTool = 0
  371. Const AnnoSelection = 1
  372. Const AnnoFreehand = 2
  373. Const AnnoHiLight = 3
  374. Const AnnoStraightLine = 4
  375. Const AnnoHollowRect = 5
  376. Const AnnoFilledRect = 6
  377. Const AnnoText = 7
  378. Const AnnoAttachNote = 8
  379. Const AnnoTextFromFile = 9
  380. Const AnnoRubberStamp = 10
  381. Const BestFit = 0
  382. Const FitWidth = 1
  383. Const FitHeight = 2
  384. Const InchToInch = 3
  385. Const ErrCancel = 32755
  386. Const ZoomMax = 6554
  387. Const ZoomMin = 2
  388. Const TiffImage = 1
  389. Const AwdImage = 2
  390. Const BmpImage = 3
  391. Const ImageChanged = "Image has changed.  Do you want to save changes?"
  392. 'Win API to determine display capabilities
  393. Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
  394. Private Sub Form_Load()
  395. 'initialize the variables
  396. Dim dc As Long
  397. Dim index As Long
  398. Selection = False
  399. Annot8Visible = False
  400. CurrentPage = 1
  401. LastPage = 1
  402. TotalPages = 1
  403. dc = hdc
  404. index = 12  '12 = BITSPERPIXEL
  405. numbits = GetDeviceCaps(dc, index) 'finds out how many colors video driver supports
  406. End Sub
  407. Private Sub Form_Resize()
  408. 'when the form is resized, position the Image Edit
  409. 'control window and\or the ThumbNail control window
  410. 'so that they fit within the new form
  411. 'dimensions.
  412. If frmSample.WindowState = 1 Or frmSample.ScaleWidth < 1 Or frmSample.ScaleHeight < 1 Then
  413.     Exit Sub 'leave if app is being minimized or the form is too small
  414. End If
  415. If mnuOnePage.Checked Then 'Just image displayed
  416.     oleImgEdit1.Left = frmSample.ScaleLeft
  417.     oleImgEdit1.Top = frmSample.ScaleTop
  418.     oleImgEdit1.Width = frmSample.ScaleWidth
  419.     oleImgEdit1.Height = frmSample.ScaleHeight
  420. ElseIf mnuThumbnail.Checked Then 'Just ThumbNail displayed
  421.     oleImgThumbnail1.Left = frmSample.ScaleLeft
  422.     oleImgThumbnail1.Top = frmSample.ScaleTop
  423.     oleImgThumbnail1.Width = frmSample.ScaleWidth
  424.     oleImgThumbnail1.Height = frmSample.ScaleHeight
  425. Else 'Image and ThumbNail displayed. ThumbNail gets 1/3 of frame, Image 2/3.
  426.     oleImgThumbnail1.Left = frmSample.ScaleLeft
  427.     oleImgThumbnail1.Top = frmSample.ScaleTop
  428.     oleImgThumbnail1.Width = frmSample.ScaleWidth
  429.     oleImgThumbnail1.Height = frmSample.ScaleHeight / 3
  430.     oleImgEdit1.Left = frmSample.ScaleLeft
  431.     oleImgEdit1.Top = frmSample.ScaleHeight / 3
  432.     oleImgEdit1.Width = frmSample.ScaleWidth
  433.     oleImgEdit1.Height = (frmSample.ScaleHeight * 2 / 3)
  434. End If
  435. End Sub
  436. Private Sub Form_Unload(Cancel As Integer)
  437. 'if image has changed, give the user a chance to
  438. 'save it before closing
  439. If oleImgEdit1.ImageModified = True Then
  440.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  441.         mnuSave_Click
  442.     End If
  443. End If
  444. End Sub
  445. Private Sub mnu100_Click()
  446. 'Set zoom to 100% and redisplay image.
  447. 'Zoom value is a float
  448. oleImgEdit1.Zoom = 100!
  449. oleImgEdit1.Refresh
  450. 'check the current menu pick and uncheck the others.
  451. mnuBestFit.Checked = False
  452. mnuFitHeight.Checked = False
  453. mnuFitWidth.Checked = False
  454. mnuActual.Checked = False
  455. mnu25.Checked = False
  456. mnu50.Checked = False
  457. mnu75.Checked = False
  458. mnu100.Checked = True
  459. mnu200.Checked = False
  460. mnu400.Checked = False
  461. End Sub
  462. Private Sub mnu200_Click()
  463. 'Set zoom to 200% and redisplay image.
  464. 'Zoom value is a float
  465. oleImgEdit1.Zoom = 200!
  466. oleImgEdit1.Refresh
  467. 'check the current menu pick and uncheck the others.
  468. mnuBestFit.Checked = False
  469. mnuFitHeight.Checked = False
  470. mnuFitWidth.Checked = False
  471. mnuActual.Checked = False
  472. mnu25.Checked = False
  473. mnu50.Checked = False
  474. mnu75.Checked = False
  475. mnu100.Checked = False
  476. mnu200.Checked = True
  477. mnu400.Checked = False
  478. End Sub
  479. Private Sub mnu25_Click()
  480. 'Set zoom to 25% and redisplay image.
  481. 'Zoom value is a float
  482. oleImgEdit1.Zoom = 25!
  483. oleImgEdit1.Refresh
  484. 'check the current menu pick and uncheck the others.
  485. mnuBestFit.Checked = False
  486. mnuFitHeight.Checked = False
  487. mnuFitWidth.Checked = False
  488. mnuActual.Checked = False
  489. mnu25.Checked = True
  490. mnu50.Checked = False
  491. mnu75.Checked = False
  492. mnu100.Checked = False
  493. mnu200.Checked = False
  494. mnu400.Checked = False
  495. End Sub
  496. Private Sub mnu400_Click()
  497. 'Set zoom to 400% and redisplay image.
  498. 'Zoom value is a float
  499. oleImgEdit1.Zoom = 400!
  500. oleImgEdit1.Refresh
  501. 'check the current menu pick and uncheck the others.
  502. mnuBestFit.Checked = False
  503. mnuFitHeight.Checked = False
  504. mnuFitWidth.Checked = False
  505. mnuActual.Checked = False
  506. mnu25.Checked = False
  507. mnu50.Checked = False
  508. mnu75.Checked = False
  509. mnu100.Checked = False
  510. mnu200.Checked = False
  511. mnu400.Checked = True
  512. End Sub
  513. Private Sub mnu50_Click()
  514. 'Set zoom to 50% and redisplay image.
  515. 'Zoom value is a float
  516. oleImgEdit1.Zoom = 50!
  517. oleImgEdit1.Refresh
  518. 'check the current menu pick and uncheck the others.
  519. mnuBestFit.Checked = False
  520. mnuFitHeight.Checked = False
  521. mnuFitWidth.Checked = False
  522. mnuActual.Checked = False
  523. mnu25.Checked = False
  524. mnu50.Checked = True
  525. mnu75.Checked = False
  526. mnu100.Checked = False
  527. mnu200.Checked = False
  528. mnu400.Checked = False
  529. End Sub
  530. Private Sub mnu75_Click()
  531. 'Set zoom to 75% and redisplay image.
  532. 'Zoom value is a float
  533. oleImgEdit1.Zoom = 75!
  534. oleImgEdit1.Refresh
  535. 'check the current menu pick and uncheck the others.
  536. mnuBestFit.Checked = False
  537. mnuFitHeight.Checked = False
  538. mnuFitWidth.Checked = False
  539. mnuActual.Checked = False
  540. mnu25.Checked = False
  541. mnu50.Checked = False
  542. mnu75.Checked = True
  543. mnu100.Checked = False
  544. mnu200.Checked = False
  545. mnu400.Checked = False
  546. End Sub
  547. Private Sub mnuAbout_Click()
  548. 'Add your code here
  549. MsgBox "Function to be implemented by user."
  550. End Sub
  551. Private Sub mnuActual_Click()
  552. 'Set fit to inch to inch and redisplay image.
  553. oleImgEdit1.FitTo (InchToInch)
  554. oleImgEdit1.Refresh
  555. 'check the current zoom menu pick and uncheck the others.
  556. mnuBestFit.Checked = False
  557. mnuFitHeight.Checked = False
  558. mnuFitWidth.Checked = False
  559. mnuActual.Checked = True
  560. mnu25.Checked = False
  561. mnu50.Checked = False
  562. mnu75.Checked = False
  563. mnu100.Checked = False
  564. mnu200.Checked = False
  565. mnu400.Checked = False
  566. End Sub
  567. Private Sub mnuAppend_Click()
  568. 'Add your code here.
  569. MsgBox "Function to be implemented by user."
  570. End Sub
  571. Private Sub mnuAttachNote_Click()
  572. 'see documentation for the list of annotation types
  573. oleImgEdit1.SelectTool AnnoAttachNote
  574. 'Check the current annotation tool and uncheck all
  575. 'the others
  576. mnuNoTool.Checked = False
  577. mnuSelectPointer.Checked = False
  578. mnuAttachNote.Checked = True
  579. mnuFillRect.Checked = False
  580. mnuFreeHand.Checked = False
  581. mnuHiLight.Checked = False
  582. mnuHollowRect.Checked = False
  583. mnuStamp.Checked = False
  584. mnuStraightLine.Checked = False
  585. mnuTextFromFile.Checked = False
  586. mnuTypedText.Checked = False
  587. End Sub
  588. Private Sub mnuBack_Click()
  589. 'Save current page if modified, then return to the
  590. 'previously displayed page.
  591. If oleImgEdit1.ImageModified = True Then
  592.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  593.         mnuSave_Click
  594.     End If
  595. End If
  596. oleImgEdit1.page = LastPage
  597. oleImgEdit1.Display
  598. 'Update the selected page thumbnail
  599. oleImgThumbnail1.DeselectAllThumbs
  600. oleImgThumbnail1.ThumbSelected(LastPage) = True
  601. End Sub
  602. Private Sub mnuBestFit_Click()
  603. 'zoom the image so that the entire image
  604. 'fits in the display window
  605. oleImgEdit1.FitTo (BestFit)
  606. 'check the current menu pick and uncheck the others.
  607. mnuBestFit.Checked = True
  608. mnuFitHeight.Checked = False
  609. mnuFitWidth.Checked = False
  610. mnuZoomToSelection.Checked = False
  611. mnu25.Checked = False
  612. mnu50.Checked = False
  613. mnu75.Checked = False
  614. mnu100.Checked = False
  615. mnu200.Checked = False
  616. mnu400.Checked = False
  617. End Sub
  618. Private Sub mnuBurnIn_Click()
  619. 'burn in all visible annotations,(1,) and preserve
  620. 'colors, (2).  See documentation for other valid arguments.
  621. ret = oleImgEdit1.BurnInAnnotations(1, 2)
  622. End Sub
  623. Private Sub mnuConvert_Click()
  624. 'Add your code here.
  625. MsgBox "Function to be implemented by user."
  626. End Sub
  627. Private Sub mnuCopy_Click()
  628. 'Copy the selected area to the clipboard.
  629. If Selection = True Then
  630.     oleImgEdit1.ClipboardCopy
  631. End If
  632. End Sub
  633. Private Sub mnuCopyPage_Click()
  634. 'Add your code here.
  635. MsgBox "Function to be implemented by user."
  636. End Sub
  637. Private Sub mnuCustom_Click()
  638. 'Add your code here.
  639. MsgBox "Function to be implemented by user."
  640. End Sub
  641. Private Sub mnuCut_Click()
  642. 'Cut the selected area to the clipboard.
  643. If Selection = True Then
  644.     oleImgEdit1.ClipboardCut
  645. End If
  646. End Sub
  647. Private Sub mnuDeletePage_Click()
  648. 'Add your code here.
  649. MsgBox "Function to be implemented by user."
  650. End Sub
  651. Private Sub mnuDrag_Click()
  652. 'Add your code here.
  653. MsgBox "Function to be implemented by user."
  654. End Sub
  655. Private Sub mnuExit_Click()
  656. 'Close the app
  657. Unload frmSample
  658. End Sub
  659. Private Sub mnuFillRect_Click()
  660. 'see documentation for the list of annotation types
  661. oleImgEdit1.SelectTool AnnoFilledRect
  662. 'Check the current annotation tool and uncheck all
  663. 'the others
  664. mnuNoTool.Checked = False
  665. mnuSelectPointer.Checked = False
  666. mnuAttachNote.Checked = False
  667. mnuFillRect.Checked = True
  668. mnuFreeHand.Checked = False
  669. mnuHiLight.Checked = False
  670. mnuHollowRect.Checked = False
  671. mnuStamp.Checked = False
  672. mnuStraightLine.Checked = False
  673. mnuTextFromFile.Checked = False
  674. mnuTypedText.Checked = False
  675. End Sub
  676. Private Sub mnuFirst_Click()
  677. 'Save current page if modified, then store the current
  678. 'page number and display the first page
  679. If oleImgEdit1.ImageModified = True Then
  680.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  681.         mnuSave_Click
  682.     End If
  683. End If
  684. LastPage = oleImgEdit1.page
  685. oleImgEdit1.page = 1
  686. oleImgEdit1.Display
  687. 'Update the selected page thumbnail
  688. oleImgThumbnail1.DeselectAllThumbs
  689. oleImgThumbnail1.ThumbSelected(1) = True
  690. End Sub
  691. Private Sub mnuFitHeight_Click()
  692. 'Zoom the image so that its vertical
  693. 'dimension fits within the display window
  694. oleImgEdit1.FitTo (FitHeight)
  695. 'check the current menu pick and uncheck the others.
  696. mnuBestFit.Checked = False
  697. mnuFitHeight.Checked = True
  698. mnuFitWidth.Checked = False
  699. mnuZoomToSelection.Checked = False
  700. mnu25.Checked = False
  701. mnu50.Checked = False
  702. mnu75.Checked = False
  703. mnu100.Checked = False
  704. mnu200.Checked = False
  705. mnu400.Checked = False
  706. End Sub
  707. Private Sub mnuFitWidth_Click()
  708. 'Zoom the image so that its horizontal
  709. 'dimension fits within the display window
  710. oleImgEdit1.FitTo (FitWidth)
  711. 'check the current menu pick and uncheck the others.
  712. mnuBestFit.Checked = False
  713. mnuFitHeight.Checked = False
  714. mnuFitWidth.Checked = True
  715. mnuZoomToSelection.Checked = False
  716. mnu25.Checked = False
  717. mnu50.Checked = False
  718. mnu75.Checked = False
  719. mnu100.Checked = False
  720. mnu200.Checked = False
  721. mnu400.Checked = False
  722. End Sub
  723. Private Sub mnuFlip_Click()
  724. 'Rotate the image 180 degrees.
  725. oleImgEdit1.Flip
  726. End Sub
  727. Private Sub mnuFreeHand_Click()
  728. 'see documentation for the list of annotation types
  729. oleImgEdit1.SelectTool AnnoFreehand
  730. 'Check the current annotation tool and uncheck all
  731. 'the others
  732. mnuNoTool.Checked = False
  733. mnuSelectPointer.Checked = False
  734. mnuAttachNote.Checked = False
  735. mnuFillRect.Checked = False
  736. mnuFreeHand.Checked = True
  737. mnuHiLight.Checked = False
  738. mnuHollowRect.Checked = False
  739. mnuStamp.Checked = False
  740. mnuStraightLine.Checked = False
  741. mnuTextFromFile.Checked = False
  742. mnuTypedText.Checked = False
  743. End Sub
  744. Private Sub mnuFullScreen_Click()
  745. 'resize the Image Edit window to maximize the display
  746. If mnuFullScreen.Checked Then
  747.     frmSample.WindowState = 0
  748.     mnuFullScreen.Checked = False
  749.     frmSample.WindowState = 2
  750.     mnuFullScreen.Checked = True
  751. End If
  752. End Sub
  753. Private Sub mnuGoTo_Click()
  754. 'Save current page if modified, then store the current
  755. 'page number and display the GoTo Page dialog box
  756. If oleImgEdit1.ImageModified = True Then
  757.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  758.         mnuSave_Click
  759.     End If
  760. End If
  761. LastPage = oleImgEdit1.page
  762. frmGotoDlg.Show
  763. End Sub
  764. Private Sub mnuHelp_Click()
  765. 'Add your code here.
  766. MsgBox "Function to be implemented by user."
  767. End Sub
  768. Private Sub mnuHideAnnotation_Click()
  769. 'Toggle the display of annotations
  770. If mnuHideAnnotation.Checked = True Then
  771.     'show all hidden annotations
  772.     oleImgEdit1.ShowAnnotationGroup
  773.     oleImgEdit1.Refresh
  774.     mnuHideAnnotation.Checked = False
  775.     'hide all displayed annotations
  776.     oleImgEdit1.HideAnnotationGroup
  777.     oleImgEdit1.Refresh
  778.     mnuHideAnnotation.Checked = True
  779. End If
  780. End Sub
  781. Private Sub mnuHiLight_Click()
  782. 'see documentation for the list of annotation types
  783. oleImgEdit1.SelectTool AnnoHiLight
  784. 'Check the current annotation tool and uncheck all
  785. 'the others
  786. mnuNoTool.Checked = False
  787. mnuSelectPointer.Checked = False
  788. mnuAttachNote.Checked = False
  789. mnuFillRect.Checked = False
  790. mnuFreeHand.Checked = False
  791. mnuHiLight.Checked = True
  792. mnuHollowRect.Checked = False
  793. mnuStamp.Checked = False
  794. mnuStraightLine.Checked = False
  795. mnuTextFromFile.Checked = False
  796. mnuTypedText.Checked = False
  797. End Sub
  798. Private Sub mnuHollowRect_Click()
  799. 'see documentation for the list of annotation types
  800. oleImgEdit1.SelectTool AnnoHollowRect
  801. 'Check the current annotation tool and uncheck all
  802. 'the others
  803. mnuNoTool.Checked = False
  804. mnuSelectPointer.Checked = False
  805. mnuAttachNote.Checked = False
  806. mnuFillRect.Checked = False
  807. mnuFreeHand.Checked = False
  808. mnuHiLight.Checked = False
  809. mnuHollowRect.Checked = True
  810. mnuStamp.Checked = False
  811. mnuStraightLine.Checked = False
  812. mnuTextFromFile.Checked = False
  813. mnuTypedText.Checked = False
  814. End Sub
  815. Private Sub mnuInsert_Click()
  816. 'Add your code here.
  817. MsgBox "Function to be implemented by user."
  818. End Sub
  819. Private Sub mnuLast_Click()
  820. 'Save current page if modified, then store the current
  821. 'page number and display the last page
  822. Dim page As Long 'number of last page
  823. If oleImgEdit1.ImageModified = True Then
  824.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  825.         mnuSave_Click
  826.     End If
  827. End If
  828. LastPage = oleImgEdit1.page
  829. page = oleImgEdit1.PageCount
  830. oleImgEdit1.page = page
  831. oleImgEdit1.Display
  832. 'Update the selected page thumbnail
  833. oleImgThumbnail1.DeselectAllThumbs
  834. oleImgThumbnail1.ThumbSelected(oleImgEdit1.page) = True
  835. End Sub
  836. Private Sub mnuLeft_Click()
  837. 'Rotate image 90 degrees to the left
  838. oleImgEdit1.RotateLeft
  839. End Sub
  840. Private Sub mnuNew_Click()
  841. 'if the current image was modified, give the user
  842. 'a chance to save it, then open a new blank image
  843. 'of the same size.
  844. If oleImgEdit1.ImageModified = True Then
  845.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  846.         mnuSave_Click
  847.     End If
  848. End If
  849. 'Use generic display values
  850. oleImgEdit1.DisplayBlankImage 500, 400, 200, 200, 1
  851. oleImgEdit1.Image = ""
  852. oleImgThumbnail1.Image = oleImgEdit1.Image
  853. 'Now that we have an image, enable the needed menus.
  854. mnuSaveAs.Enabled = True
  855. mnuSave.Enabled = True
  856. mnuPrint.Enabled = True
  857. mnuEdit.Enabled = True
  858. mnuView.Enabled = True
  859. mnuPage.Enabled = True
  860. mnuZoom.Enabled = True
  861. mnuAnnotation.Enabled = True
  862. 'This is a 1 page image, so disable the page
  863. 'change menu items
  864. mnuBack.Enabled = False
  865. mnuFirst.Enabled = False
  866. mnuGoTo.Enabled = False
  867. mnuLast.Enabled = False
  868. mnuNext.Enabled = False
  869. mnuPrevious.Enabled = False
  870. End Sub
  871. Private Sub mnuNext_Click()
  872. 'Save current page if modified, then store the current
  873. 'page number and display the next page
  874. Dim page As Long 'Page place holder
  875. If oleImgEdit1.ImageModified = True Then
  876.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  877.         mnuSave_Click
  878.     End If
  879. End If
  880. LastPage = oleImgEdit1.page
  881. page = oleImgEdit1.page
  882. If page = TotalPages Then
  883.     MsgBox "Last Page"
  884.     Exit Sub
  885. End If
  886. page = page + 1
  887. oleImgEdit1.page = page
  888. oleImgEdit1.Display
  889. 'Update the selected page thumbnail
  890. oleImgThumbnail1.DeselectAllThumbs
  891. oleImgThumbnail1.ThumbSelected(oleImgEdit1.page) = True
  892. End Sub
  893. Private Sub mnuNoTool_Click()
  894. 'see documentation for the list of annotation types
  895. oleImgEdit1.SelectTool NoTool
  896. 'Check the current annotation tool and uncheck all
  897. 'the others
  898. mnuNoTool.Checked = True
  899. mnuSelectPointer.Checked = False
  900. mnuAttachNote.Checked = False
  901. mnuFillRect.Checked = False
  902. mnuFreeHand.Checked = False
  903. mnuHiLight.Checked = False
  904. mnuHollowRect.Checked = False
  905. mnuStamp.Checked = False
  906. mnuStraightLine.Checked = False
  907. mnuTextFromFile.Checked = False
  908. mnuTypedText.Checked = False
  909. End Sub
  910. Private Sub mnuOnePage_Click()
  911. 'hide any thumbnails and expand the Image Edit
  912. 'window to fit in the form
  913. oleImgThumbnail1.Visible = False
  914. oleImgEdit1.Visible = True
  915. oleImgEdit1.Left = frmSample.ScaleLeft
  916. oleImgEdit1.Top = frmSample.ScaleTop
  917. oleImgEdit1.Width = frmSample.ScaleWidth
  918. oleImgEdit1.Height = frmSample.ScaleHeight
  919. mnuThumbnail.Checked = False
  920. mnuOnePage.Checked = True
  921. mnuPageThumbnail.Checked = False
  922. End Sub
  923. Private Sub mnuOpen_Click()
  924. 'open an image doc. If the current doc is modified,
  925. 'try to save it. ShowFileDialog(0) shows Open File
  926. 'dialog. ShowFileDialog(1) shows SaveAs File dialog.
  927. Dim temp As String 'image name and path
  928. On Error Resume Next 'handle errors ourselves incase of cancel
  929. oleImgAdmin1.Flags = 0 'clear Flags
  930. If oleImgEdit1.ImageModified = True Then
  931.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  932.         mnuSave_Click
  933.         If Err = ErrCancel Then '32755 = Cancel pressed
  934.             Exit Sub
  935.         End If
  936.     End If
  937. End If
  938. oleImgAdmin1.ShowFileDialog 0, frmSample.hWnd
  939. If Err = ErrCancel Then '32755 = Cancel pressed
  940.     Exit Sub
  941. End If
  942. If oleImgAdmin1.StatusCode <> 0 Then
  943.     MsgBox Err.Description + " Code = " + Hex(oleImgAdmin1.StatusCode), 16
  944.     Exit Sub
  945. End If
  946. temp = oleImgAdmin1.Image
  947. oleImgEdit1.Image = temp
  948. oleImgThumbnail1.Image = oleImgEdit1.Image
  949. If numbits > 8 Then 'video driver supports hicolor or truecolor
  950.     oleImgEdit1.ImagePalette = 3 'Set for 24 bit RGB.
  951. End If
  952. oleImgEdit1.page = 1
  953. oleImgEdit1.Display
  954. TotalPages = oleImgEdit1.PageCount
  955. oleImgThumbnail1.ThumbSelected(1) = True
  956. 'Now that we have an image, enable the needed menus.
  957. mnuSaveAs.Enabled = True
  958. mnuSave.Enabled = True
  959. mnuPrint.Enabled = True
  960. mnuEdit.Enabled = True
  961. mnuView.Enabled = True
  962. mnuPage.Enabled = True
  963. mnuZoom.Enabled = True
  964. mnuAnnotation.Enabled = True
  965. If oleImgEdit1.PageCount > 1 Then
  966.     mnuBack.Enabled = True
  967.     mnuFirst.Enabled = True
  968.     mnuGoTo.Enabled = True
  969.     mnuLast.Enabled = True
  970.     mnuNext.Enabled = True
  971.     mnuPrevious.Enabled = True
  972.     mnuBack.Enabled = False
  973.     mnuFirst.Enabled = False
  974.     mnuGoTo.Enabled = False
  975.     mnuLast.Enabled = False
  976.     mnuNext.Enabled = False
  977.     mnuPrevious.Enabled = False
  978. End If
  979. End Sub
  980. Private Sub mnuOptions_Click()
  981. 'Add your code here.
  982. MsgBox "Function to be implemented by user."
  983. End Sub
  984. Private Sub mnuPageThumbnail_Click()
  985. 'Show the thumbnails accross the top third of the
  986. 'app window, and the current image in the bottom two
  987. 'thirds of the window.
  988. oleImgEdit1.Visible = True
  989. oleImgThumbnail1.Visible = True
  990. oleImgEdit1.Left = frmSample.ScaleLeft
  991. oleImgEdit1.Top = frmSample.ScaleHeight / 3
  992. oleImgEdit1.Width = frmSample.ScaleWidth
  993. oleImgEdit1.Height = (frmSample.ScaleHeight * 2 / 3)
  994. oleImgThumbnail1.Left = frmSample.ScaleLeft
  995. oleImgThumbnail1.Top = frmSample.ScaleTop
  996. oleImgThumbnail1.Width = frmSample.ScaleWidth
  997. oleImgThumbnail1.Height = frmSample.ScaleHeight / 3
  998. mnuThumbnail.Checked = False
  999. mnuOnePage.Checked = False
  1000. mnuPageThumbnail.Checked = True
  1001. End Sub
  1002. Private Sub mnuPaste_Click()
  1003. 'Paste from the clipboard
  1004. If oleImgEdit1.IsClipboardDataAvailable = True Then
  1005.     oleImgEdit1.ClipboardPaste
  1006.     Selection = False
  1007. End If
  1008. End Sub
  1009. Private Sub mnuPrevious_Click()
  1010. 'Save current page if modified, then store the current
  1011. 'page number and display the previous page
  1012. Dim page As Long 'Page number place holder
  1013. If oleImgEdit1.ImageModified = True Then
  1014.     If MsgBox(ImageChanged, vbYesNo) = vbYes Then
  1015.         mnuSave_Click
  1016.     End If
  1017. End If
  1018. LastPage = oleImgEdit1.page
  1019. page = oleImgEdit1.page
  1020. If page = 1 Then
  1021.     MsgBox "First Page"
  1022.     Exit Sub
  1023. End If
  1024. page = page - 1
  1025. oleImgEdit1.page = page
  1026. oleImgEdit1.Display
  1027. 'Update the selected page thumbnail
  1028. oleImgThumbnail1.DeselectAllThumbs
  1029. oleImgThumbnail1.ThumbSelected(oleImgEdit1.page) = True
  1030. End Sub
  1031. Private Sub mnuPrint_Click()
  1032. 'Open ImgAdmin's Print dialog and call ImgEdit's
  1033. 'Print function with the user selected options.
  1034. Dim format As Integer
  1035. Dim Annotations As Boolean
  1036. On Error Resume Next 'handle errors ourselves in case of cancel
  1037. If oleImgEdit1.ImageModified = True Then
  1038.     If MsgBox("The Image must be saved first if changes are to be printed.  Do you want to save the image?", vbYesNo) = vbYes Then
  1039.         mnuSave_Click
  1040.     End If
  1041. End If
  1042. oleImgAdmin1.Flags = 0 'clear Flags so print dialog box will display
  1043. oleImgAdmin1.ShowPrintDialog frmSample.hWnd
  1044. If oleImgAdmin1.StatusCode = 0 Then 'OK button selected
  1045.     format = oleImgAdmin1.PrintOutputFormat
  1046.     Annotations = oleImgAdmin1.PrintAnnotations
  1047.         X = oleImgEdit1.PrintImage(oleImgAdmin1.PrintStartPage, oleImgAdmin1.PrintEndPage, format, Annotations)
  1048.     If Err = ErrCancel Then '32755 = Cancel pressed
  1049.         Exit Sub
  1050.     Else
  1051.         MsgBox Err.Description + " Code = " + Hex(oleImgAdmin1.StatusCode), 16
  1052.     End If
  1053. End If
  1054. If oleImgEdit1.StatusCode <> 0 Then
  1055.     MsgBox Err.Description + " Code = " + Hex(oleImgEdit1.StatusCode), 16
  1056. End If
  1057. End Sub
  1058. Private Sub mnuPrintPage_Click()
  1059. 'Print the current page.
  1060. On Error Resume Next 'handle errors ourselves
  1061. X = oleImgEdit1.PrintImage(oleImgEdit1.page, oleImgEdit1.page)
  1062. If oleImgEdit1.StatusCode <> 0 Then
  1063.     MsgBox Err.Description + " Code = " + Hex(oleImgEdit1.StatusCode), 16
  1064. End If
  1065. End Sub
  1066. Private Sub mnuRescan_Click()
  1067. 'Add your code here.
  1068. MsgBox "Function to be implemented by user."
  1069. End Sub
  1070. Private Sub mnuRight_Click()
  1071. 'Rotate image 90 degrees to the right
  1072. oleImgEdit1.RotateRight
  1073. End Sub
  1074. Private Sub mnuSave_Click()
  1075. 'Save the current document
  1076. On Error Resume Next 'handle errors ourselves
  1077. If oleImgEdit1.Image = "" Then
  1078.     mnuSaveAs_Click
  1079.     oleImgEdit1.Save (False)
  1080.     If oleImgEdit1.StatusCode <> 0 Then
  1081.         MsgBox Err.Description + " Code = " + Hex(oleImgEdit1.StatusCode), 16
  1082.     End If
  1083. End If
  1084. End Sub
  1085. Private Sub mnuSaveAs_Click()
  1086. 'Open ImgAdmin's SaveAs dialog
  1087. Dim FileType As Integer
  1088. On Error Resume Next 'handle errors ourselves
  1089. 'we can write tiff, bmp, and awd files, so set the admin file filter
  1090. 'to show only these types.
  1091. oleImgAdmin1.Filter = "TIFF files (*.tif)|*.tif|BMP files (*.bmp)|*.bmp|AWD files(*.awd)|*.awd|"
  1092. oleImgAdmin1.ShowFileDialog 1, frmSample.hWnd
  1093. If Err = ErrCancel Then '32755 = Cancel pressed
  1094.     Exit Sub
  1095. End If
  1096. If oleImgAdmin1.Image = oleImgEdit1.Image Then 'Save as current name
  1097.     oleImgEdit1.Save False
  1098. Else 'Save as newly selected name and change image name to selected name
  1099.     'determine from the filter index which file type was selected
  1100.     If oleImgAdmin1.FilterIndex = 1 Then
  1101.         FileType = TiffImage
  1102.     ElseIf oleImgAdmin1.FilterIndex = 2 Then
  1103.         FileType = BmpImage
  1104.     Else
  1105.         FileType = AwdImage
  1106.     End If
  1107.     oleImgEdit1.SaveAs oleImgAdmin1.Image, FileType
  1108.     oleImgEdit1.Image = oleImgAdmin1.Image
  1109.     oleImgAdmin1.Image = oleImgEdit1.Image 'this forces a refresh of the properties in the Admin control
  1110. End If
  1111. oleImgAdmin1.FilterIndex = 0
  1112. oleImgAdmin1.Filter = ""
  1113. If oleImgEdit1.StatusCode <> 0 Then
  1114.     MsgBox Err.Description + " Code = " + Hex(oleImgEdit1.StatusCode), 16
  1115.     Exit Sub
  1116. End If
  1117. End Sub
  1118. Private Sub mnuScaleToGray_Click()
  1119. 'toggle image in 4 bit grayscale
  1120. If mnuScaleToGray.Checked = True Then
  1121.     oleImgEdit1.DisplayScaleAlgorithm = 0
  1122.     oleImgEdit1.Refresh
  1123.     mnuScaleToGray.Checked = False
  1124.     oleImgEdit1.DisplayScaleAlgorithm = 2
  1125.     oleImgEdit1.Refresh
  1126.     mnuScaleToGray.Checked = True
  1127. End If
  1128. End Sub
  1129. Private Sub mnuSelect_Click()
  1130. 'Add your code here.
  1131. MsgBox "Function to be implemented by user."
  1132. End Sub
  1133. Private Sub mnuSelectPointer_Click()
  1134. 'see documentation for the list of annotation types
  1135. oleImgEdit1.SelectTool AnnoSelection
  1136. 'Check the current annotation tool and uncheck all
  1137. 'the others
  1138. mnuNoTool.Checked = False
  1139. mnuSelectPointer.Checked = True
  1140. mnuAttachNote.Checked = False
  1141. mnuFillRect.Checked = False
  1142. mnuFreeHand.Checked = False
  1143. mnuHiLight.Checked = False
  1144. mnuHollowRect.Checked = False
  1145. mnuStamp.Checked = False
  1146. mnuStraightLine.Checked = False
  1147. mnuTextFromFile.Checked = False
  1148. mnuTypedText.Checked = False
  1149. End Sub
  1150. Private Sub mnuSend_Click()
  1151. 'Add your code here.
  1152. MsgBox "Function to be implemented by user."
  1153. End Sub
  1154. Private Sub mnuShowTools_Click()
  1155. 'If the tool palette is visible, close it.  If it's
  1156. 'not visible, open it.
  1157. If Annot8Visible = True Then
  1158.     oleImgEdit1.HideAnnotationToolPalette
  1159.     Annot8Visible = False
  1160.     mnuShowTools.Checked = False
  1161.     oleImgEdit1.ShowAnnotationToolPalette
  1162.     Annot8Visible = True
  1163.     mnuShowTools.Checked = True
  1164. End If
  1165. End Sub
  1166. Private Sub mnuStamp_Click()
  1167. 'Bring up the Rubber Stamp Properties dialog to choose the stamp you want.
  1168. oleImgEdit1.ShowRubberStampDialog
  1169. 'Check the current annotation tool and uncheck all
  1170. 'the others
  1171. mnuNoTool.Checked = False
  1172. mnuSelectPointer.Checked = False
  1173. mnuAttachNote.Checked = False
  1174. mnuFillRect.Checked = False
  1175. mnuFreeHand.Checked = False
  1176. mnuHiLight.Checked = False
  1177. mnuHollowRect.Checked = False
  1178. mnuStamp.Checked = True
  1179. mnuStraightLine.Checked = False
  1180. mnuTextFromFile.Checked = False
  1181. mnuTypedText.Checked = False
  1182. End Sub
  1183. Private Sub mnuStraightLine_Click()
  1184. 'see documentation for the list of annotation types
  1185. oleImgEdit1.SelectTool AnnoStraightLine
  1186. 'Check the current annotation tool and uncheck all
  1187. 'the others
  1188. mnuNoTool.Checked = False
  1189. mnuSelectPointer.Checked = False
  1190. mnuAttachNote.Checked = False
  1191. mnuFillRect.Checked = False
  1192. mnuFreeHand.Checked = False
  1193. mnuHiLight.Checked = False
  1194. mnuHollowRect.Checked = False
  1195. mnuStamp.Checked = False
  1196. mnuStraightLine.Checked = True
  1197. mnuTextFromFile.Checked = False
  1198. mnuTypedText.Checked = False
  1199. End Sub
  1200. Private Sub mnuTextFromFile_Click()
  1201. 'see documentation for the list of annotation types
  1202. oleImgEdit1.SelectTool AnnoTextFromFile
  1203. 'Check the current annotation tool and uncheck all
  1204. 'the others
  1205. mnuNoTool.Checked = False
  1206. mnuSelectPointer.Checked = False
  1207. mnuAttachNote.Checked = False
  1208. mnuFillRect.Checked = False
  1209. mnuFreeHand.Checked = False
  1210. mnuHiLight.Checked = False
  1211. mnuHollowRect.Checked = False
  1212. mnuStamp.Checked = False
  1213. mnuStraightLine.Checked = False
  1214. mnuTextFromFile.Checked = True
  1215. mnuTypedText.Checked = False
  1216. End Sub
  1217. Private Sub mnuThumbnail_Click()
  1218. 'Size the thumbnail window to the app window and
  1219. 'display it. Hide the image window.
  1220. oleImgThumbnail1.Left = frmSample.ScaleLeft
  1221. oleImgThumbnail1.Top = frmSample.ScaleTop
  1222. oleImgThumbnail1.Width = frmSample.ScaleWidth
  1223. oleImgThumbnail1.Height = frmSample.ScaleHeight
  1224. oleImgThumbnail1.Visible = True
  1225. oleImgEdit1.Visible = False
  1226. 'oleImgThumbnail1.Image = oleImgEdit1.Image
  1227. mnuThumbnail.Checked = True
  1228. mnuOnePage.Checked = False
  1229. mnuPageThumbnail.Checked = False
  1230. End Sub
  1231. Private Sub mnuToolbar_Click()
  1232. 'Add your code here.
  1233. MsgBox "Function to be implemented by user."
  1234. End Sub
  1235. Private Sub mnuTypedText_Click()
  1236. 'see documentation for the list of annotation types
  1237. oleImgEdit1.SelectTool AnnoText
  1238. 'Check the current annotation tool and uncheck all
  1239. 'the others
  1240. mnuNoTool.Checked = False
  1241. mnuSelectPointer.Checked = False
  1242. mnuAttachNote.Checked = False
  1243. mnuFillRect.Checked = False
  1244. mnuFreeHand.Checked = False
  1245. mnuHiLight.Checked = False
  1246. mnuHollowRect.Checked = False
  1247. mnuStamp.Checked = False
  1248. mnuStraightLine.Checked = False
  1249. mnuTextFromFile.Checked = False
  1250. mnuTypedText.Checked = True
  1251. End Sub
  1252. Private Sub mnuZoomIn_Click()
  1253. 'Double the size of the image view
  1254. Dim zoomval As Single 'zoom value
  1255. zoomval = oleImgEdit1.Zoom
  1256. zoomval = zoomval * 2
  1257. If zoomval < ZoomMax Then
  1258.     oleImgEdit1.Zoom = zoomval
  1259.     oleImgEdit1.Refresh
  1260.     MsgBox "At maximum zoom"
  1261. End If
  1262. 'uncheck the zoom menu picks.
  1263. mnuBestFit.Checked = False
  1264. mnuFitHeight.Checked = False
  1265. mnuFitWidth.Checked = False
  1266. mnuActual.Checked = False
  1267. mnu25.Checked = False
  1268. mnu50.Checked = False
  1269. mnu75.Checked = False
  1270. mnu100.Checked = False
  1271. mnu200.Checked = False
  1272. mnu400.Checked = False
  1273. End Sub
  1274. Private Sub mnuZoomOut_Click()
  1275. 'Reduce the image by half
  1276. Dim zoomval As Single 'zoom value
  1277. zoomval = oleImgEdit1.Zoom
  1278. zoomval = zoomval / 2
  1279. If zoomval >= ZoomMin Then
  1280.     oleImgEdit1.Zoom = zoomval
  1281.     oleImgEdit1.Refresh
  1282.     MsgBox "At minimum zoom"
  1283. End If
  1284. 'uncheck the zoom menu picks.
  1285. mnuBestFit.Checked = False
  1286. mnuFitHeight.Checked = False
  1287. mnuFitWidth.Checked = False
  1288. mnuActual.Checked = False
  1289. mnu25.Checked = False
  1290. mnu50.Checked = False
  1291. mnu75.Checked = False
  1292. mnu100.Checked = False
  1293. mnu200.Checked = False
  1294. mnu400.Checked = False
  1295. End Sub
  1296. Private Sub mnuZoomToSelection_Click()
  1297. 'Zoom the part of the image in selection
  1298. 'rect to the size of the image window
  1299. If Selection = True Then
  1300.     oleImgEdit1.ZoomToSelection
  1301. End If
  1302. 'check the current menu pick and uncheck the others.
  1303. mnuBestFit.Checked = False
  1304. mnuFitHeight.Checked = False
  1305. mnuFitWidth.Checked = False
  1306. mnuActual.Checked = False
  1307. mnu25.Checked = False
  1308. mnu50.Checked = False
  1309. mnu75.Checked = False
  1310. mnu100.Checked = False
  1311. mnu200.Checked = False
  1312. mnu400.Checked = False
  1313. End Sub
  1314. Private Sub oleImgEdit1_SelectionRectDrawn(ByVal Left As Long, ByVal Top As Long, ByVal Width As Long, ByVal Height As Long)
  1315. 'Determine if a selection rect has been drawn
  1316. If Width = 0 And Height = 0 Then
  1317.     Selection = False
  1318.     Selection = True
  1319. End If
  1320. End Sub
  1321. Private Sub oleImgEdit1_ToolPaletteHidden(ByVal Left As Long, ByVal Top As Long)
  1322. 'The tool palette has been hidden.  Uncheck its menu item.
  1323.     Annot8Visible = False
  1324.     mnuShowTools.Checked = False
  1325. End Sub
  1326. Private Sub oleImgThumbnail1_Click(ByVal ThumbNumber As Long)
  1327. 'Change the displayed page to the one represented by
  1328. 'the thumbnail that the user clicked on
  1329. If ThumbNumber > 0 Then
  1330.     frmSample.oleImgEdit1.page = ThumbNumber
  1331.     frmSample.oleImgEdit1.Display
  1332.     frmSample.oleImgThumbnail1.DeselectAllThumbs
  1333.     frmSample.oleImgThumbnail1.ThumbSelected(ThumbNumber) = True
  1334. End If
  1335. End Sub
  1336.