VERSION 5.00
Object = "{E48EFDBF-5838-4A7D-95DD-BC0EC914BD4A}#1.2#0"; "StarCEComponents.ocx"
Begin VB.Form Form1 
   Caption         =   "CropSample"
   ClientHeight    =   2145
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   2145
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin StarCEComponents.Crop Crop1 
      Height          =   855
      Left            =   960
      TabIndex        =   7
      Top             =   2640
      Width           =   3375
      _ExtentX        =   5953
      _ExtentY        =   1508
      Appearance      =   1
      BackColor       =   -2147483633
      BackStyle       =   1
      BorderStyle     =   0
      Enabled         =   -1  'True
      ShowLabels      =   0   'False
   End
   Begin VB.TextBox Text3 
      Height          =   285
      Left            =   2520
      TabIndex        =   6
      Top             =   1200
      Width           =   2055
   End
   Begin VB.TextBox Text2 
      Height          =   285
      Left            =   120
      TabIndex        =   4
      Top             =   1200
      Width           =   2055
   End
   Begin StarCEComponents.ConfigurationHandler ConfigurationHandler1 
      Left            =   120
      Top             =   1680
      _ExtentX        =   1931
      _ExtentY        =   873
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Save"
      Height          =   375
      Left            =   3360
      TabIndex        =   2
      Top             =   1680
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Left            =   120
      TabIndex        =   1
      Text            =   "Star TSP100 Cutter (TSP143)"
      Top             =   480
      Width           =   4455
   End
   Begin VB.Label Label3 
      Caption         =   "Bottom Crop Length:"
      Height          =   255
      Left            =   2520
      TabIndex        =   5
      Top             =   960
      Width           =   2055
   End
   Begin VB.Label Label2 
      Caption         =   "Top Crop Length:"
      Height          =   255
      Left            =   120
      TabIndex        =   3
      Top             =   960
      Width           =   2055
   End
   Begin VB.Label Label1 
      Caption         =   "Printer Queue Name:"
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   1695
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

' This variable will let us know if a configuration file
' has been loaded into the ConfigurationHandler object
Dim ConfigurationLoaded As Boolean

Private Sub Command1_Click()
    LoadConfiguration
    
    ' Load the ConfigurationHandler control into the Crop control
    ' From this point on, all functions and properties used by this control
    ' will affect the configuration file that was loaded into this
    ' ConfigruationHandler
    Crop1.SetConfigurationHandler Me.ConfigurationHandler1
    
    ' Store the entered top and bottom crop lengths into the control
    Crop1.TopCrop = CDbl(Text1.Text)
    Crop1.BottomCrop = CDbl(Text2.Text)
    
    ' Save the configuration to the file that the specified printer queue is using
    ConfigurationHandler1.SaveConfigurationToQueue Text1.Text
End Sub

Private Sub Form_Load()
    ' The configuration is not loaded by default
    ConfigurationLoaded = False
End Sub

Private Sub LoadConfiguration()
    ' This function will load the a configuration file into the ConfigurationHandler control
    ' The file loaded is the file used by the printer queue specified in Text1
    If Not ConfigurationLoaded Then
        If ConfigurationHandler1.LoadConfigurationFromQueue(Text1.Text) Then
            ConfigurationLoaded = True
        Else
            MsgBox "Error loading configuration. Please enter a valid printer queue name.", vbExclamation Or vbOKOnly, "Error"
        End If
    End If
End Sub
