ImgEdit ImgScan 的用法原來這麼簡單(編號:4407)

好像kodak的控制項沒什麼人在討論,弟剛好需控制到CCD捉影像,在
在MSDN內找到下列的說明,只要在FORM中加入所用到的控制項(KODAK)及就可輕鬆的捉下所拍的圖及加入簡單的文字或圖形編輯及儲存.
Private Sub cmdDestImage2_Click()
'The DestImageControl property must be set to match
  'the value specified in the ImgEdit's ImageControl property.
  'This would scan to an ImgEdit control referred to as ImgEdit1
  ImgScan1.DestImageControl = "ImgEdit1"
  ImgScan1.StartScan
End Sub

Private Sub cmdDisplay_Click()
'Initialize the Image property to check for Cancel pressed.
  'When the dialog box is shown, check for a value in the
  'Image property.
  ImgAdmin1.Image = ""
  'Specify a dialog title and a list filter rather than using
  'the defaults.
  ImgAdmin1.DialogTitle = "Select Image for Display"
  ImgAdmin1.Filter = "All Image Files !*.bmp; *.jpg; *.tif! Bitmap Files(*.bmp)!*. bmp! JPG Files (*.jpg)!*.jpg! TIFF Files (*.tif)!*.tif!All Files (*.*)!*.*!"
  ' Default filter will be TIFF (fourth item).
  ImgAdmin1.FilterIndex = 4
  'Set the InitDir property to the preferred directory.
  ImgAdmin1.InitDir = "C:\images"
  ImgAdmin1.CancelError = False
  'Note: if you have Server Access software installed this
  'will automatically be enabled in the Open dialog box after
  'the user authenticates.
  ImgAdmin1.ShowFileDialog OpenDlg, Form1.hWnd
  'Determine if a file was selected or cancel was pressed
  If ImgAdmin1.Image = "" Then Exit Sub
  'Set the image properties in the Image Edit and Thumbnail controls
  'to the name of the file selected in the dialog box.
  ImgEdit1.Image = ImgAdmin1.Image
  ImgThumbnail1.Image = ImgAdmin1.Image
  'Display the image in the ImgEdit and Thumbnail control.
  ImgEdit1.Display
End Sub
Private Sub cmdSaveAs_Click()
ImgAdmin1.ShowFileDialog SaveDlg
  ImgEdit1.SaveAs ImgAdmin1.Image
End Sub

Private Sub cmdDestImage_Click()
'If there are multiple ImgEdit controls within an
  'application, use the DestImage control to define
  'which image window to place annotation marks on.

'ImageControl names will default to ImgEdit1, ImgEdit2,
  'etc. at the time the controls are drawn. The control
  'name could be changed at design time if desired.

'Draw a straight line on the Image Edit control whose
  'ImageControl name is ImgEdit2
  ImgAnnTool1.DestImageControl = "ImgEdit2"
  ImgAnnTool1.AnnotationType = wiStraightLine
  'ImgAnnTool1.Draw 10, 10, 100, 100
  
  'Sets the AnnotationType to a filled rectangle and
  'the fill color of the rectangle to blue using Visual
  'Basic color constants.
  ImgAnnTool1.AnnotationType = wiFilledRect '4
  ImgAnnTool1.AnnotationFillColor = vbBlue
  
  'Draw the blue rectangle on the Image Edit control whose
  'ImageControl name is ImgEdit1
  ImgAnnTool1.DestImageControl = "ImgEdit1"
  ImgAnnTool1.Draw 10, 10, 100, 100
End Sub


Private Sub cmdToolPal_Click()
'An example of showing the annotation tool palette with user
  'defined tooltips. If Tool tips are not specified default values
  'are provided
  'True parameter allows user to right click on a tool on the
  'palette to set attributes (color, size, etc) for that tool
  'If location is not specified, palette is positioned relative
  'to ImgEdit control
 
  ToolTips$ = "Tool Tip #1!Tool Tip #2!Tool Tip #3!Tool Tip #4!Tool Tip #5!Tool Tip #6!Tool Tip #7!Tool Tip #8!Tool Tip #9!Tool Tip #10!Tool Tip #11"
  'Tool palette will appear in its default location since it is not specified
  ImgEdit1.ShowAnnotationToolPalette True, , , ToolTips$
End Sub


Private Sub cmdInsert_Click()
'Use the ImgAdmin control to select a file for display
   'in the ImgEdit control.
   ImgAdmin1.ShowFileDialog OpenDlg '0
   ImgEdit1.Image = ImgAdmin1.Image
   ImgEdit1.Display
   'For insert or append, set the Scan control's
   'Image property.
   ImgScan1.Image = ImgAdmin1.Image
   'MultiPage property must be set to True in order to
   'create files with more than one page.
   ImgScan1.MultiPage = True
   ImgScan1.PageOption = InsertPages '3
   ImgScan1.Page = 1
   ImgScan1.FileType = TIFF '1
   'Scan using the Scan Page dialog box.
   ImgScan1.ShowScanPage
End Sub