home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 1999 October / PCpro_1999_10.ISO / Tools / scrint9a / Source / Form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  1998-07-14  |  18.3 KB  |  524 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
  3. Object = "{84926CA3-2941-101C-816F-0E6013114B7F}#1.0#0"; "IMGSCAN.OCX"
  4. Object = "{6D940288-9F11-11CE-83FD-02608C3EC08A}#1.0#0"; "IMGEDIT.OCX"
  5. Object = "{009541A3-3B81-101C-92F3-040224009C02}#1.0#0"; "IMGADMIN.OCX"
  6. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.1#0"; "RICHTX32.OCX"
  7. Begin VB.Form Form1 
  8.    ClientHeight    =   5430
  9.    ClientLeft      =   60
  10.    ClientTop       =   345
  11.    ClientWidth     =   5745
  12.    Icon            =   "Form1.frx":0000
  13.    LinkTopic       =   "Form1"
  14.    ScaleHeight     =   5430
  15.    ScaleWidth      =   5745
  16.    StartUpPosition =   2  'Bildschirmmitte
  17.    Begin ScanLibCtl.ImgScan ImgScan1 
  18.       Left            =   480
  19.       Top             =   6120
  20.       _Version        =   65536
  21.       _ExtentX        =   1402
  22.       _ExtentY        =   1296
  23.       _StockProps     =   0
  24.       DestImageControl=   "ImgEdit1"
  25.       PageOption      =   0
  26.       PageType        =   6
  27.       CompressionType =   1
  28.       CompressionInfo =   0
  29.       MultiPage       =   -1  'True
  30.       ScanTo          =   5
  31.    End
  32.    Begin VB.PictureBox Layer 
  33.       BorderStyle     =   0  'Kein
  34.       DrawStyle       =   6  'Innen ausgef
  35.       Height          =   4455
  36.       Index           =   0
  37.       Left            =   240
  38.       ScaleHeight     =   4455
  39.       ScaleWidth      =   4995
  40.       TabIndex        =   1
  41.       Top             =   720
  42.       Width           =   4995
  43.       Begin VB.CommandButton Btn 
  44.          Height          =   1620
  45.          Index           =   0
  46.          Left            =   3240
  47.          Picture         =   "Form1.frx":030A
  48.          Style           =   1  'Grafisch
  49.          TabIndex        =   4
  50.          Top             =   2700
  51.          Width           =   1620
  52.       End
  53.       Begin VB.PictureBox ImgEdit1Frame3D 
  54.          Height          =   4335
  55.          Left            =   0
  56.          ScaleHeight     =   4629.964
  57.          ScaleMode       =   0  'Benutzer
  58.          ScaleWidth      =   3045
  59.          TabIndex        =   2
  60.          Top             =   0
  61.          Width           =   3105
  62.          Begin ImgeditLibCtl.ImgEdit ImgEdit1 
  63.             Height          =   2115
  64.             Left            =   840
  65.             TabIndex        =   3
  66.             Top             =   1080
  67.             Width           =   1695
  68.             _Version        =   65536
  69.             _ExtentX        =   2990
  70.             _ExtentY        =   3731
  71.             _StockProps     =   0
  72.             ImageControl    =   "ImgEdit1"
  73.             SelectionRectangleEnabled=   0   'False
  74.             BorderStyle     =   0
  75.             DisplayScaleAlgorithm=   4
  76.          End
  77.       End
  78.       Begin VB.Label CounterImg 
  79.          Alignment       =   2  'Zentriert
  80.          BackColor       =   &H00000000&
  81.          BorderStyle     =   1  'Fest Einfach
  82.          Caption         =   "01"
  83.          BeginProperty Font 
  84.             Name            =   "Courier New"
  85.             Size            =   63.75
  86.             Charset         =   0
  87.             Weight          =   700
  88.             Underline       =   0   'False
  89.             Italic          =   0   'False
  90.             Strikethrough   =   0   'False
  91.          EndProperty
  92.          ForeColor       =   &H000000FF&
  93.          Height          =   1455
  94.          Left            =   3360
  95.          TabIndex        =   20
  96.          Top             =   120
  97.          Width           =   1455
  98.       End
  99.    End
  100.    Begin VB.PictureBox Layer 
  101.       BorderStyle     =   0  'Kein
  102.       DrawStyle       =   6  'Innen ausgef
  103.       Height          =   4575
  104.       Index           =   1
  105.       Left            =   240
  106.       ScaleHeight     =   4575
  107.       ScaleWidth      =   4635
  108.       TabIndex        =   5
  109.       Top             =   600
  110.       Width           =   4635
  111.       Begin VB.PictureBox SubLayer1 
  112.          BorderStyle     =   0  'Kein
  113.          Height          =   2895
  114.          Left            =   120
  115.          ScaleHeight     =   2895
  116.          ScaleWidth      =   3135
  117.          TabIndex        =   10
  118.          Top             =   120
  119.          Width           =   3135
  120.          Begin VB.Frame Frame1 
  121.             Height          =   855
  122.             Left            =   0
  123.             TabIndex        =   17
  124.             Top             =   2040
  125.             Width           =   3135
  126.             Begin VB.CheckBox ShowSpecificSetupChk 
  127.                Caption         =   "Scanner-eigenes Setup anzeigen"
  128.                Height          =   255
  129.                Left            =   120
  130.                TabIndex        =   19
  131.                Top             =   240
  132.                Width           =   2895
  133.             End
  134.             Begin VB.CheckBox ShowSpecificSetupFirstPageChk 
  135.                Caption         =   "Nur beim ersten Scan"
  136.                Height          =   255
  137.                Left            =   360
  138.                TabIndex        =   18
  139.                Top             =   480
  140.                Width           =   2175
  141.             End
  142.          End
  143.          Begin VB.Frame Frame2 
  144.             Height          =   1455
  145.             Left            =   0
  146.             TabIndex        =   13
  147.             Top             =   0
  148.             Width           =   3135
  149.             Begin VB.CommandButton Btn 
  150.                Caption         =   "&Bildeinstellungen"
  151.                Height          =   300
  152.                Index           =   3
  153.                Left            =   120
  154.                TabIndex        =   16
  155.                Top             =   960
  156.                Width           =   2820
  157.             End
  158.             Begin VB.CommandButton Btn 
  159.                Caption         =   "&Druckerauswahl"
  160.                Height          =   315
  161.                Index           =   2
  162.                Left            =   120
  163.                TabIndex        =   15
  164.                Top             =   600
  165.                Width           =   2820
  166.             End
  167.             Begin VB.CommandButton Btn 
  168.                Caption         =   "&Scannerauswahl"
  169.                Height          =   300
  170.                Index           =   1
  171.                Left            =   120
  172.                TabIndex        =   14
  173.                Top             =   240
  174.                Width           =   2820
  175.             End
  176.          End
  177.          Begin VB.Frame Frame3 
  178.             Height          =   615
  179.             Left            =   0
  180.             TabIndex        =   11
  181.             Top             =   1440
  182.             Width           =   3135
  183.             Begin VB.CheckBox AskBeforePrintChk 
  184.                Caption         =   "Ausdruck quittieren lassen"
  185.                Height          =   255
  186.                Left            =   120
  187.                TabIndex        =   12
  188.                Top             =   240
  189.                Width           =   2535
  190.             End
  191.          End
  192.       End
  193.    End
  194.    Begin VB.PictureBox Layer 
  195.       BorderStyle     =   0  'Kein
  196.       DrawStyle       =   6  'Innen ausgef
  197.       Height          =   4455
  198.       Index           =   2
  199.       Left            =   240
  200.       ScaleHeight     =   4455
  201.       ScaleWidth      =   4995
  202.       TabIndex        =   6
  203.       Top             =   600
  204.       Width           =   4995
  205.       Begin RichTextLib.RichTextBox Rtf 
  206.          Height          =   3375
  207.          Left            =   840
  208.          TabIndex        =   7
  209.          Top             =   360
  210.          Width           =   3135
  211.          _ExtentX        =   5530
  212.          _ExtentY        =   5953
  213.          _Version        =   327681
  214.          BorderStyle     =   0
  215.          Enabled         =   -1  'True
  216.          ReadOnly        =   -1  'True
  217.          ScrollBars      =   2
  218.          TextRTF         =   $"Form1.frx":2234
  219.       End
  220.    End
  221.    Begin ComctlLib.TabStrip TabStrip1 
  222.       Height          =   5235
  223.       Left            =   60
  224.       TabIndex        =   0
  225.       Top             =   60
  226.       Width           =   5235
  227.       _ExtentX        =   9234
  228.       _ExtentY        =   9234
  229.       ShowTips        =   0   'False
  230.       _Version        =   327682
  231.       BeginProperty Tabs {0713E432-850A-101B-AFC0-4210102A8DA7} 
  232.          NumTabs         =   4
  233.          BeginProperty Tab1 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  234.             Caption         =   "Kopierer"
  235.             Key             =   ""
  236.             Object.Tag             =   ""
  237.             ImageVarType    =   2
  238.          EndProperty
  239.          BeginProperty Tab2 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  240.             Caption         =   "Optionen"
  241.             Key             =   ""
  242.             Object.Tag             =   ""
  243.             ImageVarType    =   2
  244.          EndProperty
  245.          BeginProperty Tab3 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  246.             Caption         =   "Hilfe"
  247.             Key             =   ""
  248.             Object.Tag             =   ""
  249.             ImageVarType    =   2
  250.          EndProperty
  251.          BeginProperty Tab4 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  252.             Caption         =   "Info"
  253.             Key             =   ""
  254.             Object.Tag             =   ""
  255.             ImageVarType    =   2
  256.          EndProperty
  257.       EndProperty
  258.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  259.          Name            =   "MS Sans Serif"
  260.          Size            =   8.25
  261.          Charset         =   0
  262.          Weight          =   400
  263.          Underline       =   0   'False
  264.          Italic          =   0   'False
  265.          Strikethrough   =   0   'False
  266.       EndProperty
  267.    End
  268.    Begin VB.PictureBox Layer 
  269.       BorderStyle     =   0  'Kein
  270.       DrawStyle       =   6  'Innen ausgef
  271.       Height          =   4575
  272.       Index           =   3
  273.       Left            =   240
  274.       ScaleHeight     =   4575
  275.       ScaleWidth      =   4635
  276.       TabIndex        =   8
  277.       Top             =   720
  278.       Width           =   4635
  279.       Begin VB.Label WwInfo 
  280.          AutoSize        =   -1  'True
  281.          BackStyle       =   0  'Transparent
  282.          Height          =   195
  283.          Left            =   840
  284.          TabIndex        =   9
  285.          Top             =   1080
  286.          Width           =   660
  287.          WordWrap        =   -1  'True
  288.       End
  289.    End
  290.    Begin AdminLibCtl.ImgAdmin ImgAdmin1 
  291.       Left            =   1560
  292.       Top             =   6240
  293.       _Version        =   65536
  294.       _ExtentX        =   1402
  295.       _ExtentY        =   1296
  296.       _StockProps     =   0
  297.       CancelError     =   0   'False
  298.       PrintStartPage  =   0
  299.       PrintEndPage    =   0
  300.    End
  301. Attribute VB_Name = "Form1"
  302. Attribute VB_GlobalNameSpace = False
  303. Attribute VB_Creatable = False
  304. Attribute VB_PredeclaredId = True
  305. Attribute VB_Exposed = False
  306. '----------------------------------------------------
  307. '###SCRINT V1.0 (C) 1998 by W.Wirth
  308. '----------------------------------------------------
  309. Option Explicit
  310. Const Title = "Scrint f
  311. r Windows 95(A)"
  312. Const cScrintFile = "Scrint.tif"
  313. Const cLogoFile = "Logo.tif"
  314. Const cHelpFile = "Scrint.rtf"
  315. Const dh = 60
  316. Const dw = 60
  317. Const phScan = 0
  318. Const phPrint = 1
  319. Const phPrinterSel = 2
  320. Const cPrintNowMsg = "Soll die eingescannte Seite jetzt gedruckt werden?"
  321. Const SettingIntro = "Wolfgang Wirth's VB-Tools"
  322. Const SettingAskBeforePrint = "AskBeforePrint"
  323. Const SettingShowSpecificSetup = "ShowSpecificSetup"
  324. Const SettingShowSpecificSetupFirstPage = "ShowSpecificSetupFirstPage"
  325. Const cWwInfo = "Scrint + Scanner + Printer = Fotokopierer" + vbCr + vbCr + _
  326.                 "
  327.  1998 by Wolfgang Wirth" + vbCr + vbCr + _
  328.                 "'Verbesserungsvorschl
  329. ge und konstruktive Kritik sind mir immer willkommen!'" + vbCr + vbCr + _
  330.                 "E-Mail: Toolmaker@iname.com" + vbCr + vbCr + _
  331.                 "Homepage: http://perso.wanadoo.fr/wolfgang.wirth/"
  332. Dim ScrintFile As String
  333. Dim LogoFile As String
  334. Dim FormatValue As Integer
  335. Dim SetupValue As Integer
  336. Dim CurrLayer As Integer
  337. Dim CopyCounter As Integer
  338. Dim FirstScanDone As Boolean
  339. Private Sub AskBeforePrintChk_Click()
  340.     SaveSetting SettingIntro, Title, SettingAskBeforePrint, AskBeforePrintChk.Value
  341. End Sub
  342. Private Sub CounterImg_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  343. Dim i As Integer
  344.     i = ImgAdmin1.PrintNumCopies
  345.     If Button = 2 Then If i > 1 Then SetCopyCounter i - 1 Else Beep
  346.     If Button = 1 Then If i < 99 Then SetCopyCounter i + 1 Else Beep
  347. End Sub
  348. Private Sub Form_Load()
  349.     Caption = Title
  350.     WwInfo.Caption = cWwInfo
  351.     SetCurrLayer 0
  352.     ScrintFile = App.Path + "\" + cScrintFile
  353.     LogoFile = App.Path + "\" + cLogoFile
  354.     ImgEdit1.Image = ScrintFile
  355.     ImgEdit1.ImagePalette = wiPaletteRGB24
  356.     ImgScan1.Image = ScrintFile
  357.     ImgScan1.FileType = TIFF
  358.     ImgScan1.MultiPage = False
  359.     ImgScan1.ScanTo = DisplayAndFile
  360.     ImgScan1.PageOption = CreateNewFile
  361.     SetCopyCounter 1
  362.     Rtf.LoadFile cHelpFile
  363.     AskBeforePrintChk.Value = GetSetting(SettingIntro, Title, SettingAskBeforePrint, 0)
  364.     ShowSpecificSetupChk.Value = GetSetting(SettingIntro, Title, SettingShowSpecificSetup, 1)
  365.     ShowSpecificSetupFirstPageChk.Value = GetSetting(SettingIntro, Title, SettingShowSpecificSetupFirstPage, 0)
  366. End Sub
  367. Sub SetCopyCounter(i As Integer)
  368.     If i > 99 Then i = 99
  369.     ImgAdmin1.PrintNumCopies = i
  370.     CounterImg.Caption = Right("0" & i, 2)
  371. End Sub
  372. Private Sub Btn_Click(Index As Integer)
  373.     '### Taster auswerten
  374.     Select Case Index
  375.         Case 0: 'Copy-Taste
  376.             Scrint phScan
  377.         Case 1: 'Scannerauswahl
  378.             ImgScan1.ShowSelectScanner
  379.         Case 2: 'Druckerauswahl
  380.             Scrint phPrinterSel
  381.         Case 3: 'Scannereinstellungen (SCRINT-eigen)
  382.             ImgScan1.ShowScanPreferences
  383.     End Select
  384. End Sub
  385. Private Sub ImgScan1_ScanDone()
  386.     Scrint phPrint
  387. End Sub
  388. Private Sub ShowSpecificSetupChk_Click()
  389.     SaveSetting SettingIntro, Title, SettingShowSpecificSetup, ShowSpecificSetupChk.Value
  390. End Sub
  391. Private Sub ShowSpecificSetupFirstPageChk_Click()
  392.     SaveSetting SettingIntro, Title, SettingShowSpecificSetupFirstPage, ShowSpecificSetupFirstPageChk.Value
  393. End Sub
  394.  Sub TabStrip1_Click()
  395.     SetCurrLayer TabStrip1.SelectedItem.Index - 1
  396. End Sub
  397.  Sub SetCurrLayer(i As Integer)
  398.     CurrLayer = i
  399.     Layer(CurrLayer).ZOrder 0
  400. End Sub
  401. Private Sub Form_Resize()
  402. Dim i As Long
  403.     If WindowState <> 1 Then
  404.         i = 2.8 * Btn(0).Width
  405.         If Width < i Then Width = i
  406.         i = 2.4 * Btn(0).Height
  407.         If Height < i Then Height = i
  408.         
  409.         With TabStrip1
  410.             .Width = ScaleWidth - 2 * dw
  411.             .Height = ScaleHeight - 2 * dh
  412.             .Top = dh
  413.             .Left = dw
  414.         End With
  415.         
  416.         For i = 0 To 3
  417.             With Layer(i)
  418.                 .Width = TabStrip1.ClientWidth
  419.                 .Height = TabStrip1.ClientHeight
  420.                 .Top = TabStrip1.ClientTop
  421.                 .Left = TabStrip1.ClientLeft
  422.             End With
  423.         Next
  424.         
  425.         With Btn(0)
  426.             .Top = Layer(0).ScaleHeight - .Height - dh
  427.             .Left = Layer(0).ScaleWidth - .Width - dw
  428.         End With
  429.         
  430.         With CounterImg
  431.             If .Height + 2 * dh < Btn(0).Top Then
  432.                 .Width = Btn(0).Width
  433.                 '.Height = btn(0).Height
  434.                 .Top = dh
  435.                 .Left = Btn(0).Left
  436.                 .Visible = True
  437.             Else
  438.                 .Visible = False
  439.             End If
  440.         End With
  441.         
  442.         With ImgEdit1Frame3D
  443.             .Width = Btn(0).Left - 3 * dw
  444.             .Height = Layer(0).ScaleHeight - 2 * dh
  445.             .Top = dh
  446.             .Left = dw
  447.         End With
  448.         
  449.         ImgEdit1.Width = ImgEdit1Frame3D.ScaleWidth
  450.         ImgEdit1.Height = ImgEdit1Frame3D.ScaleHeight
  451.         ImgEdit1.Top = 0
  452.         ImgEdit1.Left = 0
  453.         
  454.         ImgEdit1.FitTo 0
  455.         
  456.         With Rtf
  457.             .Width = Layer(0).ScaleWidth - 2 * dw
  458.             .Height = Layer(0).ScaleHeight - 2 * dh
  459.             .Top = dh
  460.             .Left = dw
  461.         End With
  462.     End If
  463.     With WwInfo
  464.         .Top = (Layer(0).ScaleHeight - .Height) / 2
  465.         .Left = (Layer(0).ScaleWidth - .Width) / 2
  466.     End With
  467.     With SubLayer1
  468.         .Top = (Layer(0).ScaleHeight - .Height) / 2
  469.         .Left = (Layer(0).ScaleWidth - .Width) / 2
  470.     End With
  471. End Sub
  472. Sub Scrint(Phase As Integer)
  473. Dim bPrintAborted As Boolean
  474.     On Error GoTo ScrintError
  475.     Select Case Phase
  476.         Case phScan '---ScanPhase
  477.             '--- Scanner eig. Setup einblenden?
  478.             ImgScan1.ShowSetupBeforeScan = True
  479.             If ShowSpecificSetupChk.Value = 1 Then
  480.                 If ShowSpecificSetupFirstPageChk.Value = 1 Then
  481.                     If FirstScanDone Then
  482.                         ImgScan1.ShowSetupBeforeScan = False
  483.                     End If
  484.                 End If
  485.             Else
  486.                 ImgScan1.ShowSetupBeforeScan = False
  487.             End If
  488.             '--- Scan vorbereiten und starten
  489.             ImgAdmin1.Image = ScrintFile
  490.             If ImgAdmin1.VerifyImage(0) Then Kill ScrintFile
  491.             ImgScan1.StartScan
  492.         Case phPrint '---DruckPhase
  493.             '--- Scan fertig. Jetzt speichern und dann drucken
  494.             ImgScan1.CloseScanner
  495.             ImgEdit1.SaveAs ScrintFile, , , , , False
  496.             ImgEdit1.FitTo 0
  497.             ImgEdit1.Display
  498.             '--- Quittierung vor Druck gew
  499. nscht?
  500.             If AskBeforePrintChk.Value = 1 Then
  501.                 bPrintAborted = vbNo = MsgBox(cPrintNowMsg, vbYesNo, Title)
  502.             End If
  503.             If Not bPrintAborted Then
  504.                 ImgEdit1.PrintImage ImgAdmin1.PrintStartPage, ImgAdmin1.PrintEndPage, _
  505.                     ImgAdmin1.PrintOutputFormat, False
  506.                 FirstScanDone = True
  507.             End If
  508.             ImgEdit1.ClearDisplay
  509.         Case phPrinterSel '---Druckerauswahl
  510.             ImgAdmin1.Image = LogoFile
  511.             ImgAdmin1.ShowPrintDialog hWnd
  512.             ImgAdmin1.Image = ScrintFile
  513.             SetCopyCounter ImgAdmin1.PrintNumCopies
  514.     End Select
  515.     On Error GoTo 0
  516. Exit Sub
  517. '#############################################
  518. ScrintError:
  519.     MsgBox "Es kam zu folgendem Problem:" + vbCr + vbCr + Err.Description & _
  520.         " (" & Err.Number & ")" + vbCr + vbCr + "Ort: " & Err.Source + vbCr + vbCr + _
  521.         "Phase: " & Phase, vbCritical, Title
  522.     Resume Next
  523. End Sub
  524.