home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 4.00 Begin VB.Form Form1 BorderStyle = 1 'Fixed Single Caption = "Load" ClientHeight = 3615 ClientLeft = 1125 ClientTop = 4185 ClientWidth = 8775 Height = 4305 Left = 1065 LinkTopic = "Form1" LockControls = -1 'True MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 3615 ScaleWidth = 8775 Top = 3555 Width = 8895 Begin VB.Frame frmCallbackOptions Caption = "Callback Options" Height = 1215 Left = 6300 TabIndex = 21 Top = 120 Width = 2355 Begin VB.CommandButton cmdCBInc Caption = "+" Height = 255 Left = 1740 TabIndex = 26 Top = 300 Width = 255 End Begin VB.CommandButton cmdCBDec Caption = "-" Height = 255 Left = 1980 TabIndex = 25 Top = 300 Width = 255 End Begin VB.TextBox txtCallback Height = 285 Left = 1200 TabIndex = 24 Text = "txtCallback" Top = 300 Width = 495 End Begin VB.Label Label8 Caption = "CallBackLines:" Height = 255 Left = 120 TabIndex = 27 Top = 300 Width = 1095 End Begin VB.Label Label2 Caption = "Number of Callbacks:" Height = 255 Left = 120 TabIndex = 23 Top = 840 Width = 1575 End Begin VB.Label txtCallBackLines Caption = "0" Height = 255 Left = 1740 TabIndex = 22 Top = 840 Width = 555 End End Begin VB.Frame frmFIFOptions Caption = "FIF Options" Height = 2115 Left = 3840 TabIndex = 2 Top = 1380 Width = 4815 Begin VB.CommandButton cmdCHInc Caption = "+" Height = 255 Left = 4200 TabIndex = 44 Top = 1380 Width = 255 End Begin VB.CommandButton cmdCHDec Caption = "-" Height = 255 Left = 4440 TabIndex = 43 Top = 1380 Width = 255 End Begin VB.TextBox txtCropHeight Height = 285 Left = 3660 TabIndex = 42 Text = "txtCropHeight" Top = 1380 Width = 495 End Begin VB.CommandButton cmdCWInc Caption = "+" Height = 255 Left = 4200 TabIndex = 40 Top = 1020 Width = 255 End Begin VB.CommandButton cmdCWDec Caption = "-" Height = 255 Left = 4440 TabIndex = 39 Top = 1020 Width = 255 End Begin VB.TextBox txtCropWidth Height = 285 Left = 3660 TabIndex = 38 Text = "txtCropWidth" Top = 1020 Width = 495 End Begin VB.CommandButton cmdCTInc Caption = "+" Height = 255 Left = 4200 TabIndex = 36 Top = 660 Width = 255 End Begin VB.CommandButton cmdCTDec Caption = "-" Height = 255 Left = 4440 TabIndex = 35 Top = 660 Width = 255 End Begin VB.TextBox txtCropTop Height = 285 Left = 3660 TabIndex = 34 Text = "txtCropTop" Top = 660 Width = 495 End Begin VB.CommandButton cmdCLInc Caption = "+" Height = 255 Left = 4200 TabIndex = 32 Top = 300 Width = 255 End Begin VB.CommandButton cmdCLDec Caption = "-" Height = 255 Left = 4440 TabIndex = 31 Top = 300 Width = 255 End Begin VB.TextBox txtCropLeft Height = 285 Left = 3660 TabIndex = 30 Text = "txtCropLeft" Top = 300 Width = 495 End Begin VB.CheckBox chkLoadFastest Height = 255 Left = 3660 TabIndex = 28 Top = 1740 Width = 435 End Begin VB.CommandButton cmdLdHghtDec Caption = "-" Height = 255 Left = 1980 TabIndex = 18 Top = 1560 Width = 255 End Begin VB.CommandButton cmdLdHghtInc Caption = "+" Height = 255 Left = 1740 TabIndex = 19 Top = 1560 Width = 255 End Begin VB.TextBox txtLoadHeight Height = 285 Left = 1200 TabIndex = 17 Text = "txtLoadHeight" Top = 1560 Width = 495 End Begin VB.TextBox TxtLoadWidth Height = 285 Left = 1200 TabIndex = 15 Text = "txtLoadWidth" Top = 1200 Width = 495 End Begin VB.CommandButton CmdLdWdthDec Caption = "-" Height = 255 Left = 1980 TabIndex = 13 Top = 1200 Width = 255 End Begin VB.CommandButton CmdLdWdthInc Caption = "+" Height = 255 Left = 1740 TabIndex = 12 Top = 1200 Width = 255 End Begin VB.ComboBox CmbLoadScale Height = 315 Left = 1200 TabIndex = 9 Text = "cmbLoadScale" Top = 720 Width = 1275 End Begin VB.ComboBox CmbLoadOptions Height = 315 Left = 1200 TabIndex = 8 Text = "cmbLoadOptions" Top = 300 Width = 1275 End Begin VB.Label Label13 Caption = "CropHeight:" Height = 255 Left = 2580 TabIndex = 45 Top = 1380 Width = 975 End Begin VB.Label Label12 Caption = "CropWidth:" Height = 255 Left = 2580 TabIndex = 41 Top = 1020 Width = 975 End Begin VB.Label Label11 Caption = "CropTop:" Height = 255 Left = 2580 TabIndex = 37 Top = 660 Width = 975 End Begin VB.Label Label10 Caption = "CropLeft:" Height = 255 Left = 2580 TabIndex = 33 Top = 300 Width = 975 End Begin VB.Label Label9 Caption = "LoadFastest:" Height = 255 Left = 2580 TabIndex = 29 Top = 1740 Width = 975 End Begin VB.Label Label5 Caption = "LoadHeight:" Height = 255 Left = 120 TabIndex = 20 Top = 1560 Width = 975 End Begin VB.Label Label7 Caption = "LoadWidth:" Height = 255 Left = 120 TabIndex = 7 Top = 1200 Width = 975 End Begin VB.Label Label6 Caption = "LoadScale:" Height = 255 Left = 120 TabIndex = 6 Top = 720 Width = 855 End Begin VB.Label Label4 Caption = "LoadOptions:" Height = 255 Left = 120 TabIndex = 5 Top = 300 Width = 1215 End End Begin VB.Frame frmTIFFOptions Caption = "TIFF Options" Height = 735 Left = 3840 TabIndex = 1 Top = 600 Width = 2355 Begin VB.CommandButton CmdImNumDec Caption = "-" Height = 255 Left = 1980 TabIndex = 11 Top = 300 Width = 255 End Begin VB.CommandButton CmdImNumInc Caption = "+" Height = 255 Left = 1740 TabIndex = 10 Top = 300 Width = 255 End Begin VB.TextBox TxtImageNumber Height = 285 Left = 1200 TabIndex = 4 Text = "txtImageNumber" Top = 300 Width = 495 End Begin VB.Label Label1 Caption = "ImageNumber:" Height = 255 Left = 120 TabIndex = 3 Top = 300 Width = 1095 End End Begin VB.ComboBox CmbImageType Height = 315 Left = 3840 TabIndex = 0 Text = "cmbImageType" Top = 240 Width = 2355 End Begin ik32Lib.Picbuf Picbuf1 Height = 3495 Left = 120 TabIndex = 16 Top = 0 Width = 3615 _Version = 65536 _ExtentX = 6376 _ExtentY = 6165 _StockProps = 253 End Begin MSComDlg.CommonDialog CommonDialog1 Left = 120 Top = 0 _Version = 65536 _ExtentX = 847 _ExtentY = 847 _StockProps = 0 End Begin VB.Label Label3 Caption = "Load As:" Height = 255 Left = 3840 TabIndex = 14 Top = 0 Width = 855 End Begin VB.Menu mnuFile Caption = "&File" Begin VB.Menu mnuLoad Caption = "&Load Image..." End Begin VB.Menu mnuLoadWithCallbacks Caption = "Load Image With &Callbacks..." End Begin VB.Menu mnuSpacer Caption = "-" End Begin VB.Menu mnuExit Caption = "E&xit" Shortcut = ^X End End Attribute VB_Name = "Form1" Attribute VB_Creatable = False Attribute VB_Exposed = False Option Explicit 'Description: This code resets all of the text 'boxes on the form to default values. Sub ResetTextBoxes() TxtImageNumber.Text = "0" TxtLoadWidth.Text = "0" txtLoadHeight.Text = "0" txtCallback.Text = "0" txtCropLeft.Text = "0" txtCropTop.Text = "0" txtCropWidth.Text = "0" txtCropHeight.Text = "0" cmbLoadOptions.Text = cmbLoadOptions.List(0) cmbLoadScale.Text = cmbLoadScale.List(0) End Sub 'Description: This sub sets the LoadFastest 'property according to what the value of the 'check box is. Private Sub chkLoadFastest_Click() Picbuf1.LoadFastest = chkLoadFastest.Value End Sub 'Description: this checks to make sure that the 'correct file format is chosen for TIFF or FIF 'options. Private Sub CmbImageType_Click() Select Case UCase(Mid(CmbImageType.Text, Len(CmbImageType.Text) - 2, 3)) Case "IFF" frmTIFFOptions.Enabled = True ResetTextBoxes FrmFIFOptions.Enabled = False frmCallbackOptions.Enabled = False Case "FIF" FrmFIFOptions.Enabled = True frmCallbackOptions.Enabled = True frmTIFFOptions.Enabled = False Case "PEG", "PNG", "GIF" frmCallbackOptions.Enabled = True ResetTextBoxes frmTIFFOptions.Enabled = False FrmFIFOptions.Enabled = False Case Else ResetTextBoxes frmTIFFOptions.Enabled = False FrmFIFOptions.Enabled = False frmCallbackOptions.Enabled = False End Select End Sub 'Description: This procedure sets the LoadOptions 'value for FIF files. Private Sub cmbLoadOptions_Click() Picbuf1.LoadOptions = Left(cmbLoadOptions.Text, 1) End Sub 'Description: This procedure sets the value of 'the LoadScale property for FIF files. Private Sub cmbLoadScale_Click() Picbuf1.LoadScale = Left(cmbLoadScale, 1) End Sub 'Description: This code decreases the value of a 'text box Private Sub cmdCBDec_Click() txtCallback.Text = Val(txtCallback.Text) - 1 If Val(txtCallback.Text) < 0 Then txtCallback.Text = 0 End Sub 'Description: This code increases the value of a 'text box Private Sub cmdCBInc_Click() txtCallback.Text = Val(txtCallback.Text) + 1 End Sub 'Description: This code decreases the value of a 'text box Private Sub cmdCHDec_Click() txtCropHeight.Text = Val(txtCropHeight.Text) - 1 If Val(txtCropHeight.Text) < 0 Then txtCropHeight.Text = 0 End Sub 'Description: This code increases the value of a 'text box Private Sub cmdCHInc_Click() txtCropHeight.Text = Val(txtCropHeight.Text) + 1 End Sub 'Description: This code decreases the value of a 'text box Private Sub cmdCLDec_Click() txtCropLeft.Text = Val(txtCropLeft.Text) - 1 If Val(txtCropLeft.Text) < 0 Then txtCropLeft.Text = 0 End Sub 'Description: This code increases the value of a 'text box Private Sub cmdCLInc_Click() txtCropLeft.Text = Val(txtCropLeft.Text) + 1 End Sub 'Description: This code decreases the value of a 'text box Private Sub cmdCTDec_Click() txtCropTop.Text = Val(txtCropTop.Text) - 1 If Val(txtCropTop.Text) < 0 Then txtCropTop.Text = 0 End Sub 'Description: This code increases the value of a 'text box Private Sub cmdCTInc_Click() txtCropTop.Text = Val(txtCropTop.Text) + 1 End Sub 'Description: This code decreases the value of a 'text box Private Sub cmdCWDec_Click() txtCropWidth.Text = Val(txtCropWidth.Text) - 1 If Val(txtCropWidth.Text) < 0 Then txtCropWidth.Text = 0 End Sub 'Description: This code increases the value of a 'text box Private Sub cmdCWInc_Click() txtCropWidth.Text = Val(txtCropWidth.Text) + 1 End Sub 'Description: This code decreases the value of a 'text box when clicked Private Sub CmdImNumDec_Click() TxtImageNumber.Text = Val(TxtImageNumber.Text) - 1 If Val(TxtImageNumber.Text) < 0 Then TxtImageNumber = 0 End Sub 'Description: This code increases the value of a 'text box when clicked Private Sub CmdImNumInc_Click() TxtImageNumber.Text = Val(TxtImageNumber.Text) + 1 End Sub 'Description: This code decreases the value of a 'text box Private Sub cmdLdHghtDec_Click() txtLoadHeight.Text = Val(txtLoadHeight.Text) - 1 If Val(txtLoadHeight.Text) < 0 Then txtLoadHeight.Text = 0 End Sub 'Description: This code increases the value of a 'text box Private Sub cmdLdHghtInc_Click() txtLoadHeight.Text = Val(txtLoadHeight.Text) + 1 End Sub 'Description: This code decreases the value of a 'text box when clicked Private Sub CmdLdWdthDec_Click() TxtLoadWidth.Text = Val(TxtLoadWidth.Text) - 1 If Val(TxtLoadWidth.Text) < 0 Then TxtLoadWidth.Text = 0 End Sub 'Description: This code increases the value of a 'text box when clicked Private Sub CmdLdWdthInc_Click() TxtLoadWidth.Text = Val(TxtLoadWidth.Text) + 1 End Sub 'Description: This code calls a sub which ends the 'program Private Sub mnuExit_Click() ExitProgram End Sub 'Note: Due to the nature of the LoadPalette property, 'it's use is not demonstrated in this project. Private Sub Form_Load() 'Add data to image type & load options combo boxes. InitcmbLoadOptions cmbLoadOptions InitcmbLoadScale cmbLoadScale InitcmbImageFormat CmbImageType 'Set default values ResetTextBoxes frmTIFFOptions.Enabled = False FrmFIFOptions.Enabled = False frmCallbackOptions.Enabled = False 'Set PicBuf1 properties InitPicbuf Picbuf1, True End Sub 'Description: This code loads an image, according 'to what is sent back from the common dialog control Private Sub mnuLoad_Click() txtCallBackLines = 0 Picbuf1.ImageFormat = Val(Left(CmbImageType.Text, 1)) LoadImage Picbuf1, CommonDialog1 End Sub 'Description: This procedure does the same thing as 'CmdLoad, except that it uses call backs. Private Sub mnuLoadWithCallbacks_Click() Select Case UCase(Mid(CmbImageType.Text, Len(CmbImageType.Text) - 2, 3)) Case "GIF", "PNG", "PEG", "FIF" Picbuf1.CallbackLines = 1 CommonDialog1.DialogTitle = "Load Image With Callbacks" CommonDialog1.CancelError = True CommonDialog1.Filter = "all files|*.*|picture files|*.fif;*.gif;*.jpg;*.png|JPEG|*.jpg|GIF|*.gif|PNG|*.png|*.fif|FIF" CommonDialog1.FilterIndex = 2 CommonDialog1.Flags = cdlOFNHideReadOnly Or cdlOFNFileMustExist CommonDialog1.CancelError = True On Error GoTo Cancel_Click CommonDialog1.ShowOpen Picbuf1.Filename = CommonDialog1.Filename Picbuf1.LoadCallback Form1 Exit Sub Case Else MsgBox "Loading with callbacks only works with certain file formats. Please select either JPEG, PNG, GIF, or FIF from the 'Load As' Combo box.", 48, "Warning" Exit Sub End Select Cancel_Click: If Err.Number = 32755 Then Exit Sub Else MsgBox Err.Description End If End Sub 'Description: This procedure is used to demonstrate 'the Callback option for ImageKnife/OCX. Private Sub Picbuf1_Callback(Lines As Integer) DoEvents txtCallBackLines.Caption = Str(Lines) End Sub 'Description: This code sets the value of the 'picbuf property according to the value of the 'text box Private Sub txtCropHeight_Change() Picbuf1.LoadCropHeight = Val(txtCropHeight.Text) End Sub 'Description: This code sets the value of the 'picbuf property according to the value of the 'text box Private Sub txtCropLeft_Change() Picbuf1.LoadCropLeft = Val(txtCropLeft.Text) End Sub 'Description: This code sets the value of the 'picbuf property according to the value of the 'text box Private Sub txtCropTop_Change() Picbuf1.LoadCropTop = Val(txtCropTop.Text) End Sub 'Description: This code sets the value of the 'picbuf property according to the value of the 'text box Private Sub txtCropWidth_Change() Picbuf1.LoadCropWidth = Val(txtCropWidth.Text) End Sub 'Description: This sets the ImageNumber value for 'TIFF files. Private Sub TxtImageNumber_Change() Picbuf1.ImageNumber = Val(TxtImageNumber.Text) End Sub 'Description: This code sets the value of the 'picbuf property according to the value of the 'text box Private Sub txtLoadHeight_Change() Picbuf1.LoadHeight = Val(txtLoadHeight.Text) End Sub 'Description: This sub sets the value of LoadWidth 'for FIF files. Private Sub TxtLoadWidth_Change() Picbuf1.LoadWidth = Val(TxtLoadWidth.Text) End Sub