home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 1999 October / PCpro_1999_10.ISO / Tools / scrint40 / Source / Form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  1998-07-14  |  18.2 KB  |  523 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.          ReadOnly        =   -1  'True
  216.          ScrollBars      =   2
  217.          TextRTF         =   $"Form1.frx":2234
  218.       End
  219.    End
  220.    Begin ComctlLib.TabStrip TabStrip1 
  221.       Height          =   5235
  222.       Left            =   60
  223.       TabIndex        =   0
  224.       Top             =   60
  225.       Width           =   5235
  226.       _ExtentX        =   9234
  227.       _ExtentY        =   9234
  228.       ShowTips        =   0   'False
  229.       _Version        =   327682
  230.       BeginProperty Tabs {0713E432-850A-101B-AFC0-4210102A8DA7} 
  231.          NumTabs         =   4
  232.          BeginProperty Tab1 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  233.             Caption         =   "Kopierer"
  234.             Key             =   ""
  235.             Object.Tag             =   ""
  236.             ImageVarType    =   2
  237.          EndProperty
  238.          BeginProperty Tab2 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  239.             Caption         =   "Optionen"
  240.             Key             =   ""
  241.             Object.Tag             =   ""
  242.             ImageVarType    =   2
  243.          EndProperty
  244.          BeginProperty Tab3 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  245.             Caption         =   "Hilfe"
  246.             Key             =   ""
  247.             Object.Tag             =   ""
  248.             ImageVarType    =   2
  249.          EndProperty
  250.          BeginProperty Tab4 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  251.             Caption         =   "Info"
  252.             Key             =   ""
  253.             Object.Tag             =   ""
  254.             ImageVarType    =   2
  255.          EndProperty
  256.       EndProperty
  257.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  258.          Name            =   "MS Sans Serif"
  259.          Size            =   8.25
  260.          Charset         =   0
  261.          Weight          =   400
  262.          Underline       =   0   'False
  263.          Italic          =   0   'False
  264.          Strikethrough   =   0   'False
  265.       EndProperty
  266.    End
  267.    Begin VB.PictureBox Layer 
  268.       BorderStyle     =   0  'Kein
  269.       DrawStyle       =   6  'Innen ausgef
  270.       Height          =   4575
  271.       Index           =   3
  272.       Left            =   240
  273.       ScaleHeight     =   4575
  274.       ScaleWidth      =   4635
  275.       TabIndex        =   8
  276.       Top             =   720
  277.       Width           =   4635
  278.       Begin VB.Label WwInfo 
  279.          AutoSize        =   -1  'True
  280.          BackStyle       =   0  'Transparent
  281.          Height          =   195
  282.          Left            =   840
  283.          TabIndex        =   9
  284.          Top             =   1080
  285.          Width           =   660
  286.          WordWrap        =   -1  'True
  287.       End
  288.    End
  289.    Begin AdminLibCtl.ImgAdmin ImgAdmin1 
  290.       Left            =   1560
  291.       Top             =   6240
  292.       _Version        =   65536
  293.       _ExtentX        =   1402
  294.       _ExtentY        =   1296
  295.       _StockProps     =   0
  296.       CancelError     =   0   'False
  297.       PrintStartPage  =   0
  298.       PrintEndPage    =   0
  299.    End
  300. Attribute VB_Name = "Form1"
  301. Attribute VB_GlobalNameSpace = False
  302. Attribute VB_Creatable = False
  303. Attribute VB_PredeclaredId = True
  304. Attribute VB_Exposed = False
  305. '----------------------------------------------------
  306. '###SCRINT V1.0 (C) 1998 by W.Wirth
  307. '----------------------------------------------------
  308. Option Explicit
  309. Const Title = "Scrint f
  310. r Windows NT"
  311. Const cScrintFile = "Scrint.tif"
  312. Const cLogoFile = "Logo.tif"
  313. Const cHelpFile = "Scrint.rtf"
  314. Const dh = 60
  315. Const dw = 60
  316. Const phScan = 0
  317. Const phPrint = 1
  318. Const phPrinterSel = 2
  319. Const cPrintNowMsg = "Soll die eingescannte Seite jetzt gedruckt werden?"
  320. Const SettingIntro = "Wolfgang Wirth's VB-Tools"
  321. Const SettingAskBeforePrint = "AskBeforePrint"
  322. Const SettingShowSpecificSetup = "ShowSpecificSetup"
  323. Const SettingShowSpecificSetupFirstPage = "ShowSpecificSetupFirstPage"
  324. Const cWwInfo = "Scrint + Scanner + Printer = Fotokopierer" + vbCr + vbCr + _
  325.                 "
  326.  1998 by Wolfgang Wirth" + vbCr + vbCr + _
  327.                 "'Verbesserungsvorschl
  328. ge und konstruktive Kritik sind mir immer willkommen!'" + vbCr + vbCr + _
  329.                 "E-Mail: Toolmaker@iname.com" + vbCr + vbCr + _
  330.                 "Homepage: http://perso.wanadoo.fr/wolfgang.wirth/"
  331. Dim ScrintFile As String
  332. Dim LogoFile As String
  333. Dim FormatValue As Integer
  334. Dim SetupValue As Integer
  335. Dim CurrLayer As Integer
  336. Dim CopyCounter As Integer
  337. Dim FirstScanDone As Boolean
  338. Private Sub Form_Load()
  339.     Caption = Title
  340.     WwInfo.Caption = cWwInfo
  341.     SetCurrLayer 0
  342.     ScrintFile = App.Path + "\" + cScrintFile
  343.     LogoFile = App.Path + "\" + cLogoFile
  344.     ImgEdit1.Image = ScrintFile
  345.     ImgEdit1.ImagePalette = wiPaletteRGB24
  346.     ImgScan1.Image = ScrintFile
  347.     ImgScan1.FileType = TIFF
  348.     ImgScan1.MultiPage = False
  349.     ImgScan1.ScanTo = DisplayAndFile
  350.     ImgScan1.PageOption = CreateNewFile
  351.     SetCopyCounter 1
  352.     Rtf.LoadFile cHelpFile
  353.     AskBeforePrintChk.Value = GetSetting(SettingIntro, Title, SettingAskBeforePrint, 0)
  354.     ShowSpecificSetupChk.Value = GetSetting(SettingIntro, Title, SettingShowSpecificSetup, 1)
  355.     ShowSpecificSetupFirstPageChk.Value = GetSetting(SettingIntro, Title, SettingShowSpecificSetupFirstPage, 0)
  356. End Sub
  357. Private Sub AskBeforePrintChk_Click()
  358.     SaveSetting SettingIntro, Title, SettingAskBeforePrint, AskBeforePrintChk.Value
  359. End Sub
  360. Private Sub CounterImg_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  361. Dim i As Integer
  362.     i = ImgAdmin1.PrintNumCopies
  363.     If Button = 2 Then If i > 1 Then SetCopyCounter i - 1 Else Beep
  364.     If Button = 1 Then If i < 99 Then SetCopyCounter i + 1 Else Beep
  365. End Sub
  366. Sub SetCopyCounter(i As Integer)
  367.     If i > 99 Then i = 99
  368.     ImgAdmin1.PrintNumCopies = i
  369.     CounterImg.Caption = Right("0" & i, 2)
  370. End Sub
  371. Private Sub Btn_Click(Index As Integer)
  372.     '### Taster auswerten
  373.     Select Case Index
  374.         Case 0: 'Copy-Taste
  375.             Scrint phScan
  376.         Case 1: 'Scannerauswahl
  377.             ImgScan1.ShowSelectScanner
  378.         Case 2: 'Druckerauswahl
  379.             Scrint phPrinterSel
  380.         Case 3: 'Scannereinstellungen (SCRINT-eigen)
  381.             ImgScan1.ShowScanPreferences
  382.     End Select
  383. End Sub
  384. Private Sub ImgScan1_ScanDone()
  385.     Scrint phPrint
  386. End Sub
  387. Sub Scrint(Phase As Integer)
  388. Dim bPrintAborted As Boolean
  389.     On Error GoTo ScrintError
  390.     Select Case Phase
  391.         Case phScan '---ScanPhase
  392.             '--- Scanner eig. Setup einblenden?
  393.             ImgScan1.ShowSetupBeforeScan = True
  394.             If ShowSpecificSetupChk.Value = 1 Then
  395.                 If ShowSpecificSetupFirstPageChk.Value = 1 Then
  396.                     If FirstScanDone Then
  397.                         ImgScan1.ShowSetupBeforeScan = False
  398.                     End If
  399.                 End If
  400.             Else
  401.                 ImgScan1.ShowSetupBeforeScan = False
  402.             End If
  403.             '--- Scan vorbereiten und starten
  404.             ImgAdmin1.Image = ScrintFile
  405.             If ImgAdmin1.VerifyImage(0) Then Kill ScrintFile
  406.             ImgScan1.StartScan
  407.         Case phPrint '---DruckPhase
  408.             '--- Scan fertig. Jetzt speichern und dann drucken
  409.             ImgScan1.CloseScanner
  410.             ImgEdit1.SaveAs ScrintFile, , , , , False
  411.             ImgEdit1.FitTo 0
  412.             ImgEdit1.Display
  413.             '--- Quittierung vor Druck gew
  414. nscht?
  415.             If AskBeforePrintChk.Value = 1 Then
  416.                 bPrintAborted = vbNo = MsgBox(cPrintNowMsg, vbYesNo, Title)
  417.             End If
  418.             If Not bPrintAborted Then
  419.                 ImgEdit1.PrintImage ImgAdmin1.PrintStartPage, ImgAdmin1.PrintEndPage, _
  420.                     ImgAdmin1.PrintOutputFormat, False
  421.                 FirstScanDone = True
  422.             End If
  423.             ImgEdit1.ClearDisplay
  424.         Case phPrinterSel '---Druckerauswahl
  425.             ImgAdmin1.Image = LogoFile
  426.             ImgAdmin1.ShowPrintDialog hWnd
  427.             ImgAdmin1.Image = ScrintFile
  428.             SetCopyCounter ImgAdmin1.PrintNumCopies
  429.     End Select
  430.     On Error GoTo 0
  431. Exit Sub
  432. '#############################################
  433. ScrintError:
  434.     MsgBox "Es kam zu folgendem Problem:" + vbCr + vbCr + Err.Description & _
  435.         " (" & Err.Number & ")" + vbCr + vbCr + "Ort: " & Err.Source + vbCr + vbCr + _
  436.         "Phase: " & Phase, vbCritical, Title
  437.     Resume Next
  438. End Sub
  439. Private Sub ShowSpecificSetupChk_Click()
  440.     SaveSetting SettingIntro, Title, SettingShowSpecificSetup, ShowSpecificSetupChk.Value
  441. End Sub
  442. Private Sub ShowSpecificSetupFirstPageChk_Click()
  443.     SaveSetting SettingIntro, Title, SettingShowSpecificSetupFirstPage, ShowSpecificSetupFirstPageChk.Value
  444. End Sub
  445.  Sub TabStrip1_Click()
  446.     SetCurrLayer TabStrip1.SelectedItem.Index - 1
  447. End Sub
  448.  Sub SetCurrLayer(i As Integer)
  449.     CurrLayer = i
  450.     Layer(CurrLayer).ZOrder 0
  451. End Sub
  452. Private Sub Form_Resize()
  453. Dim i As Long
  454.     If WindowState <> 1 Then
  455.         i = 2.8 * Btn(0).Width
  456.         If Width < i Then Width = i
  457.         i = 2.4 * Btn(0).Height
  458.         If Height < i Then Height = i
  459.         
  460.         With TabStrip1
  461.             .Width = ScaleWidth - 2 * dw
  462.             .Height = ScaleHeight - 2 * dh
  463.             .Top = dh
  464.             .Left = dw
  465.         End With
  466.         
  467.         For i = 0 To 3
  468.             With Layer(i)
  469.                 .Width = TabStrip1.ClientWidth
  470.                 .Height = TabStrip1.ClientHeight
  471.                 .Top = TabStrip1.ClientTop
  472.                 .Left = TabStrip1.ClientLeft
  473.             End With
  474.         Next
  475.         
  476.         With Btn(0)
  477.             .Top = Layer(0).ScaleHeight - .Height - dh
  478.             .Left = Layer(0).ScaleWidth - .Width - dw
  479.         End With
  480.         
  481.         With CounterImg
  482.             If .Height + 2 * dh < Btn(0).Top Then
  483.                 .Width = Btn(0).Width
  484.                 '.Height = btn(0).Height
  485.                 .Top = dh
  486.                 .Left = Btn(0).Left
  487.                 .Visible = True
  488.             Else
  489.                 .Visible = False
  490.             End If
  491.         End With
  492.         
  493.         With ImgEdit1Frame3D
  494.             .Width = Btn(0).Left - 3 * dw
  495.             .Height = Layer(0).ScaleHeight - 2 * dh
  496.             .Top = dh
  497.             .Left = dw
  498.         End With
  499.         
  500.         ImgEdit1.Width = ImgEdit1Frame3D.ScaleWidth
  501.         ImgEdit1.Height = ImgEdit1Frame3D.ScaleHeight
  502.         ImgEdit1.Top = 0
  503.         ImgEdit1.Left = 0
  504.         
  505.         ImgEdit1.FitTo 0
  506.         
  507.         With Rtf
  508.             .Width = Layer(0).ScaleWidth - 2 * dw
  509.             .Height = Layer(0).ScaleHeight - 2 * dh
  510.             .Top = dh
  511.             .Left = dw
  512.         End With
  513.     End If
  514.     With WwInfo
  515.         .Top = (Layer(0).ScaleHeight - .Height) / 2
  516.         .Left = (Layer(0).ScaleWidth - .Width) / 2
  517.     End With
  518.     With SubLayer1
  519.         .Top = (Layer(0).ScaleHeight - .Height) / 2
  520.         .Left = (Layer(0).ScaleWidth - .Width) / 2
  521.     End With
  522. End Sub
  523.