home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 1999 October / PCpro_1999_10.ISO / Tools / scrint95 / 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 95"
  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 AskBeforePrintChk_Click()
  339.     SaveSetting SettingIntro, Title, SettingAskBeforePrint, AskBeforePrintChk.Value
  340. End Sub
  341. Private Sub Form_Load()
  342.     Caption = Title
  343.     WwInfo.Caption = cWwInfo
  344.     SetCurrLayer 0
  345.     ScrintFile = App.Path + "\" + cScrintFile
  346.     LogoFile = App.Path + "\" + cLogoFile
  347.     ImgEdit1.Image = ScrintFile
  348.     ImgEdit1.ImagePalette = wiPaletteRGB24
  349.     ImgScan1.Image = ScrintFile
  350.     ImgScan1.FileType = TIFF
  351.     ImgScan1.MultiPage = False
  352.     ImgScan1.ScanTo = DisplayAndFile
  353.     ImgScan1.PageOption = CreateNewFile
  354.     SetCopyCounter 1
  355.     Rtf.LoadFile cHelpFile
  356.     AskBeforePrintChk.Value = GetSetting(SettingIntro, Title, SettingAskBeforePrint, 0)
  357.     ShowSpecificSetupChk.Value = GetSetting(SettingIntro, Title, SettingShowSpecificSetup, 1)
  358.     ShowSpecificSetupFirstPageChk.Value = GetSetting(SettingIntro, Title, SettingShowSpecificSetupFirstPage, 0)
  359. End Sub
  360. Sub SetCopyCounter(i As Integer)
  361.     If i > 99 Then i = 99
  362.     ImgAdmin1.PrintNumCopies = i
  363.     CounterImg.Caption = Right("0" & i, 2)
  364. End Sub
  365. Private Sub Btn_Click(Index As Integer)
  366.     '### Taster auswerten
  367.     Select Case Index
  368.         Case 0: 'Copy-Taste
  369.             Scrint phScan
  370.         Case 1: 'Scannerauswahl
  371.             ImgScan1.ShowSelectScanner
  372.         Case 2: 'Druckerauswahl
  373.             Scrint phPrinterSel
  374.         Case 3: 'Scannereinstellungen (SCRINT-eigen)
  375.             ImgScan1.ShowScanPreferences
  376.     End Select
  377. End Sub
  378. Private Sub ImgScan1_ScanDone()
  379.     Scrint phPrint
  380. End Sub
  381. Sub Scrint(Phase As Integer)
  382. Dim bPrintAborted As Boolean
  383.     On Error GoTo ScrintError
  384.     Select Case Phase
  385.         Case phScan '---ScanPhase
  386.             '--- Scanner eig. Setup einblenden?
  387.             ImgScan1.ShowSetupBeforeScan = True
  388.             If ShowSpecificSetupChk.Value = 1 Then
  389.                 If ShowSpecificSetupFirstPageChk.Value = 1 Then
  390.                     If FirstScanDone Then
  391.                         ImgScan1.ShowSetupBeforeScan = False
  392.                     End If
  393.                 End If
  394.             Else
  395.                 ImgScan1.ShowSetupBeforeScan = False
  396.             End If
  397.             '--- Scan vorbereiten und starten
  398.             ImgAdmin1.Image = ScrintFile
  399.             If ImgAdmin1.VerifyImage(0) Then Kill ScrintFile
  400.             ImgScan1.StartScan
  401.         Case phPrint '---DruckPhase
  402.             '--- Scan fertig. Jetzt speichern und dann drucken
  403.             ImgScan1.CloseScanner
  404.             ImgEdit1.SaveAs ScrintFile, , , , , False
  405.             ImgEdit1.FitTo 0
  406.             ImgEdit1.Display
  407.             '--- Quittierung vor Druck gew
  408. nscht?
  409.             If AskBeforePrintChk.Value = 1 Then
  410.                 bPrintAborted = vbNo = MsgBox(cPrintNowMsg, vbYesNo, Title)
  411.             End If
  412.             If Not bPrintAborted Then
  413.                 ImgEdit1.PrintImage ImgAdmin1.PrintStartPage, ImgAdmin1.PrintEndPage, _
  414.                     ImgAdmin1.PrintOutputFormat, False
  415.                 FirstScanDone = True
  416.             End If
  417.             ImgEdit1.ClearDisplay
  418.         Case phPrinterSel '---Druckerauswahl
  419.             ImgAdmin1.Image = LogoFile
  420.             ImgAdmin1.ShowPrintDialog hWnd
  421.             ImgAdmin1.Image = ScrintFile
  422.             SetCopyCounter ImgAdmin1.PrintNumCopies
  423.     End Select
  424.     On Error GoTo 0
  425. Exit Sub
  426. '#############################################
  427. ScrintError:
  428.     MsgBox "Es kam zu folgendem Problem:" + vbCr + vbCr + Err.Description & _
  429.         " (" & Err.Number & ")" + vbCr + vbCr + "Ort: " & Err.Source + vbCr + vbCr + _
  430.         "Phase: " & Phase, vbCritical, Title
  431.     Resume Next
  432. End Sub
  433. Private Sub ShowSpecificSetupChk_Click()
  434.     SaveSetting SettingIntro, Title, SettingShowSpecificSetup, ShowSpecificSetupChk.Value
  435. End Sub
  436. Private Sub ShowSpecificSetupFirstPageChk_Click()
  437.     SaveSetting SettingIntro, Title, SettingShowSpecificSetupFirstPage, ShowSpecificSetupFirstPageChk.Value
  438. End Sub
  439.  Sub TabStrip1_Click()
  440.     SetCurrLayer TabStrip1.SelectedItem.Index - 1
  441. End Sub
  442.  Sub SetCurrLayer(i As Integer)
  443.     CurrLayer = i
  444.     Layer(CurrLayer).ZOrder 0
  445. End Sub
  446. Private Sub Form_Resize()
  447. Dim i As Long
  448.     If WindowState <> 1 Then
  449.         i = 2.8 * Btn(0).Width
  450.         If Width < i Then Width = i
  451.         i = 2.4 * Btn(0).Height
  452.         If Height < i Then Height = i
  453.         
  454.         With TabStrip1
  455.             .Width = ScaleWidth - 2 * dw
  456.             .Height = ScaleHeight - 2 * dh
  457.             .Top = dh
  458.             .Left = dw
  459.         End With
  460.         
  461.         For i = 0 To 3
  462.             With Layer(i)
  463.                 .Width = TabStrip1.ClientWidth
  464.                 .Height = TabStrip1.ClientHeight
  465.                 .Top = TabStrip1.ClientTop
  466.                 .Left = TabStrip1.ClientLeft
  467.             End With
  468.         Next
  469.         
  470.         With Btn(0)
  471.             .Top = Layer(0).ScaleHeight - .Height - dh
  472.             .Left = Layer(0).ScaleWidth - .Width - dw
  473.         End With
  474.         
  475.         With CounterImg
  476.             If .Height + 2 * dh < Btn(0).Top Then
  477.                 .Width = Btn(0).Width
  478.                 '.Height = btn(0).Height
  479.                 .Top = dh
  480.                 .Left = Btn(0).Left
  481.                 .Visible = True
  482.             Else
  483.                 .Visible = False
  484.             End If
  485.         End With
  486.         
  487.         With ImgEdit1Frame3D
  488.             .Width = Btn(0).Left - 3 * dw
  489.             .Height = Layer(0).ScaleHeight - 2 * dh
  490.             .Top = dh
  491.             .Left = dw
  492.         End With
  493.         
  494.         ImgEdit1.Width = ImgEdit1Frame3D.ScaleWidth
  495.         ImgEdit1.Height = ImgEdit1Frame3D.ScaleHeight
  496.         ImgEdit1.Top = 0
  497.         ImgEdit1.Left = 0
  498.         
  499.         ImgEdit1.FitTo 0
  500.         
  501.         With Rtf
  502.             .Width = Layer(0).ScaleWidth - 2 * dw
  503.             .Height = Layer(0).ScaleHeight - 2 * dh
  504.             .Top = dh
  505.             .Left = dw
  506.         End With
  507.     End If
  508.     With WwInfo
  509.         .Top = (Layer(0).ScaleHeight - .Height) / 2
  510.         .Left = (Layer(0).ScaleWidth - .Width) / 2
  511.     End With
  512.     With SubLayer1
  513.         .Top = (Layer(0).ScaleHeight - .Height) / 2
  514.         .Left = (Layer(0).ScaleWidth - .Width) / 2
  515.     End With
  516. End Sub
  517. Private Sub CounterImg_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  518. Dim i As Integer
  519.     i = ImgAdmin1.PrintNumCopies
  520.     If Button = 2 Then If i > 1 Then SetCopyCounter i - 1 Else Beep
  521.     If Button = 1 Then If i < 99 Then SetCopyCounter i + 1 Else Beep
  522. End Sub
  523.