home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 5 / MasteringVisualBasic5.iso / olympus / ik32_15t / vb4.shr / RUBBER.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-08-07  |  14.2 KB  |  475 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Rubber"
  5.    ClientHeight    =   5670
  6.    ClientLeft      =   1605
  7.    ClientTop       =   2010
  8.    ClientWidth     =   7095
  9.    Height          =   6360
  10.    Left            =   1545
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   5670
  16.    ScaleWidth      =   7095
  17.    Top             =   1380
  18.    Width           =   7215
  19.    Begin VB.Frame Frame4 
  20.       Caption         =   "Draw Properties"
  21.       Height          =   1455
  22.       Left            =   120
  23.       TabIndex        =   28
  24.       Top             =   4080
  25.       Width           =   4215
  26.       Begin VB.TextBox txtDW 
  27.          Height          =   285
  28.          Left            =   120
  29.          TabIndex        =   1
  30.          Text            =   "txtDW"
  31.          Top             =   960
  32.          Width           =   735
  33.       End
  34.       Begin VB.CommandButton cmdFC 
  35.          Caption         =   "F&ore Color"
  36.          Height          =   375
  37.          Left            =   3000
  38.          TabIndex        =   13
  39.          Top             =   840
  40.          Width           =   1095
  41.       End
  42.       Begin VB.CommandButton cmdBC 
  43.          Caption         =   "&Back Color"
  44.          Height          =   375
  45.          Left            =   3000
  46.          TabIndex        =   12
  47.          Top             =   240
  48.          Width           =   1095
  49.       End
  50.       Begin VB.ComboBox cmbRO 
  51.          Height          =   315
  52.          Left            =   120
  53.          TabIndex        =   0
  54.          Text            =   "cmbRO"
  55.          Top             =   480
  56.          Width           =   1815
  57.       End
  58.       Begin VB.Shape Shape2 
  59.          BackColor       =   &H00000000&
  60.          BackStyle       =   1  'Opaque
  61.          Height          =   375
  62.          Left            =   2040
  63.          Top             =   840
  64.          Width           =   855
  65.       End
  66.       Begin VB.Shape Shape1 
  67.          BackColor       =   &H00000000&
  68.          BackStyle       =   1  'Opaque
  69.          Height          =   375
  70.          Left            =   2040
  71.          Top             =   240
  72.          Width           =   855
  73.       End
  74.       Begin VB.Label Label12 
  75.          Caption         =   "RasterOp"
  76.          Height          =   255
  77.          Left            =   120
  78.          TabIndex        =   30
  79.          Top             =   240
  80.          Width           =   735
  81.       End
  82.       Begin VB.Label Label11 
  83.          Caption         =   "DrawWidth"
  84.          Height          =   255
  85.          Left            =   960
  86.          TabIndex        =   29
  87.          Top             =   960
  88.          Width           =   1215
  89.       End
  90.    End
  91.    Begin VB.Frame Frame3 
  92.       Caption         =   "Scale Properties"
  93.       Height          =   1215
  94.       Left            =   4440
  95.       TabIndex        =   25
  96.       Top             =   0
  97.       Width           =   2535
  98.       Begin VB.TextBox txtSS 
  99.          Height          =   285
  100.          Left            =   120
  101.          TabIndex        =   3
  102.          Text            =   "txtSS"
  103.          Top             =   720
  104.          Width           =   1215
  105.       End
  106.       Begin VB.TextBox txtSI 
  107.          Height          =   285
  108.          Left            =   120
  109.          TabIndex        =   2
  110.          Text            =   "txtSI"
  111.          Top             =   360
  112.          Width           =   1215
  113.       End
  114.       Begin VB.Label Label2 
  115.          Caption         =   "ScaleScreen"
  116.          Height          =   255
  117.          Left            =   1440
  118.          TabIndex        =   27
  119.          Top             =   720
  120.          Width           =   975
  121.       End
  122.       Begin VB.Label Label1 
  123.          Caption         =   "ScaleImage"
  124.          Height          =   255
  125.          Left            =   1440
  126.          TabIndex        =   26
  127.          Top             =   360
  128.          Width           =   855
  129.       End
  130.    End
  131.    Begin VB.Frame Frame2 
  132.       Caption         =   "Print Properties"
  133.       Height          =   1935
  134.       Left            =   4440
  135.       TabIndex        =   20
  136.       Top             =   3600
  137.       Width           =   2535
  138.       Begin VB.TextBox txtPrnH 
  139.          Height          =   285
  140.          Left            =   120
  141.          TabIndex        =   11
  142.          Text            =   "txtPrnH"
  143.          Top             =   1440
  144.          Width           =   1215
  145.       End
  146.       Begin VB.TextBox txtPrnW 
  147.          Height          =   285
  148.          Left            =   120
  149.          TabIndex        =   10
  150.          Text            =   "txtPrnW"
  151.          Top             =   1080
  152.          Width           =   1215
  153.       End
  154.       Begin VB.TextBox txtPrnT 
  155.          Height          =   285
  156.          Left            =   120
  157.          TabIndex        =   9
  158.          Text            =   "txtPrnT"
  159.          Top             =   720
  160.          Width           =   1215
  161.       End
  162.       Begin VB.TextBox txtPrnL 
  163.          Height          =   285
  164.          Left            =   120
  165.          TabIndex        =   8
  166.          Text            =   "txtPrnL"
  167.          Top             =   360
  168.          Width           =   1215
  169.       End
  170.       Begin VB.Label Label10 
  171.          Caption         =   "PrintHeight"
  172.          Height          =   255
  173.          Left            =   1440
  174.          TabIndex        =   24
  175.          Top             =   1440
  176.          Width           =   855
  177.       End
  178.       Begin VB.Label Label9 
  179.          Caption         =   "PrintWidth"
  180.          Height          =   255
  181.          Left            =   1440
  182.          TabIndex        =   23
  183.          Top             =   1080
  184.          Width           =   855
  185.       End
  186.       Begin VB.Label Label8 
  187.          Caption         =   "PrintTop"
  188.          Height          =   255
  189.          Left            =   1440
  190.          TabIndex        =   22
  191.          Top             =   720
  192.          Width           =   735
  193.       End
  194.       Begin VB.Label Label7 
  195.          Caption         =   "PrintLeft"
  196.          Height          =   255
  197.          Left            =   1440
  198.          TabIndex        =   21
  199.          Top             =   360
  200.          Width           =   975
  201.       End
  202.    End
  203.    Begin VB.Frame Frame1 
  204.       Caption         =   "Select Properties"
  205.       Height          =   1935
  206.       Left            =   4440
  207.       TabIndex        =   15
  208.       Top             =   1440
  209.       Width           =   2535
  210.       Begin VB.TextBox txtSelH 
  211.          Height          =   285
  212.          Left            =   120
  213.          TabIndex        =   7
  214.          Text            =   "txtSelH"
  215.          Top             =   1440
  216.          Width           =   1215
  217.       End
  218.       Begin VB.TextBox txtSelW 
  219.          Height          =   285
  220.          Left            =   120
  221.          TabIndex        =   6
  222.          Text            =   "txtSelW"
  223.          Top             =   1080
  224.          Width           =   1215
  225.       End
  226.       Begin VB.TextBox txtSelT 
  227.          Height          =   285
  228.          Left            =   120
  229.          TabIndex        =   5
  230.          Text            =   "txtSelT"
  231.          Top             =   720
  232.          Width           =   1215
  233.       End
  234.       Begin VB.TextBox txtSelL 
  235.          Height          =   285
  236.          Left            =   120
  237.          TabIndex        =   4
  238.          Text            =   "txtSelL"
  239.          Top             =   360
  240.          Width           =   1215
  241.       End
  242.       Begin VB.Label Label6 
  243.          Caption         =   "SelectHeight"
  244.          Height          =   255
  245.          Left            =   1440
  246.          TabIndex        =   19
  247.          Top             =   1440
  248.          Width           =   975
  249.       End
  250.       Begin VB.Label Label5 
  251.          Caption         =   "SelectWidth"
  252.          Height          =   255
  253.          Left            =   1440
  254.          TabIndex        =   18
  255.          Top             =   1080
  256.          Width           =   975
  257.       End
  258.       Begin VB.Label Label4 
  259.          Caption         =   "SelectTop"
  260.          Height          =   255
  261.          Left            =   1440
  262.          TabIndex        =   17
  263.          Top             =   720
  264.          Width           =   855
  265.       End
  266.       Begin VB.Label Label3 
  267.          Caption         =   "SelectLeft"
  268.          Height          =   255
  269.          Left            =   1440
  270.          TabIndex        =   16
  271.          Top             =   360
  272.          Width           =   975
  273.       End
  274.    End
  275.    Begin ik32Lib.Picbuf Picbuf1 
  276.       Height          =   3975
  277.       Left            =   120
  278.       TabIndex        =   14
  279.       Top             =   0
  280.       Width           =   4215
  281.       _Version        =   65536
  282.       _ExtentX        =   7435
  283.       _ExtentY        =   7011
  284.       _StockProps     =   253
  285.       ScrollBars      =   3
  286.    End
  287.    Begin MSComDlg.CommonDialog CommonDialog 
  288.       Left            =   6480
  289.       Top             =   3240
  290.       _Version        =   65536
  291.       _ExtentX        =   847
  292.       _ExtentY        =   847
  293.       _StockProps     =   0
  294.    End
  295.    Begin VB.Menu mnuFile 
  296.       Caption         =   "&File"
  297.       Begin VB.Menu mnuLoad 
  298.          Caption         =   "&Load Image..."
  299.       End
  300.       Begin VB.Menu mnuFileOpen8BitWhite 
  301.          Caption         =   "Load &8 bit White"
  302.       End
  303.       Begin VB.Menu mnuFileOpen24BitWhite 
  304.          Caption         =   "Load &24 bit White"
  305.       End
  306.       Begin VB.Menu mnuFileOpen8BitRGB 
  307.          Caption         =   "Load 8 bit &RGB"
  308.       End
  309.       Begin VB.Menu mnuFileOpen24BitRGB 
  310.          Caption         =   "Load 24 bit R&GB"
  311.       End
  312.       Begin VB.Menu mnuSave 
  313.          Caption         =   "&Save Image..."
  314.       End
  315.       Begin VB.Menu mnuSpacer 
  316.          Caption         =   "-"
  317.       End
  318.       Begin VB.Menu mnuExit 
  319.          Caption         =   "E&xit"
  320.       End
  321.    End
  322.    Begin VB.Menu mnuZoom 
  323.       Caption         =   "&Zoom"
  324.       Begin VB.Menu mnuZoomIn 
  325.          Caption         =   "&In"
  326.       End
  327.       Begin VB.Menu mnuZoomOut 
  328.          Caption         =   "&Out"
  329.       End
  330.    End
  331.    Begin VB.Menu mnuUpdate 
  332.       Caption         =   "&Update"
  333.       Begin VB.Menu mnuUpdateSelP 
  334.          Caption         =   "&Select Properties"
  335.          Checked         =   -1  'True
  336.       End
  337.       Begin VB.Menu mnuUpdatePrnP 
  338.          Caption         =   "&Print Properties"
  339.       End
  340.    End
  341. Attribute VB_Name = "Form1"
  342. Attribute VB_Creatable = False
  343. Attribute VB_Exposed = False
  344. Dim nInc As Integer
  345. ' Sets the drawing parameters
  346. Sub SetDraw()
  347.     Picbuf1.DrawWidth = CInt(txtDW.Text)
  348.     Picbuf1.RasterOp = cmbRO.ListIndex
  349. End Sub
  350. Sub SetPrintProps()
  351.     txtPrnL.Text = Str$(Picbuf1.PrintLeft)
  352.     txtPrnT.Text = Str$(Picbuf1.PrintTop)
  353.     txtPrnW.Text = Str$(Picbuf1.PrintWidth)
  354.     txtPrnH.Text = Str$(Picbuf1.PrintHeight)
  355. End Sub
  356. Sub SetScaleProps()
  357.     txtSI.Text = Str$(Picbuf1.ScaleImage)
  358.     txtSS.Text = Str$(Picbuf1.ScaleScreen)
  359. End Sub
  360. Sub SetSelectProps()
  361.     txtSelL.Text = Str$(Picbuf1.SelectLeft)
  362.     txtSelT.Text = Str$(Picbuf1.SelectTop)
  363.     txtSelW.Text = Str$(Picbuf1.SelectWidth)
  364.     txtSelH.Text = Str$(Picbuf1.SelectHeight)
  365. End Sub
  366. Sub ToggleUpdateMenu()
  367.     mnuUpdatePrnP.Checked = Not mnuUpdatePrnP.Checked
  368.     mnuUpdateSelP.Checked = Not mnuUpdateSelP.Checked
  369. End Sub
  370. Sub Zoom(nOption As Integer)
  371.     If nOption = 1 Then
  372.         ' zoom out
  373.         If Picbuf1.ScaleScreen > 1 Then
  374.             Picbuf1.ScaleScreen = Picbuf1.ScaleScreen - nInc
  375.         Else
  376.             Picbuf1.ScaleImage = Picbuf1.ScaleImage + nInc
  377.         End If
  378.     Else
  379.         ' zoom in
  380.         If Picbuf1.ScaleImage > 1 Then
  381.             Picbuf1.ScaleImage = Picbuf1.ScaleImage - nInc
  382.         Else
  383.             Picbuf1.ScaleScreen = Picbuf1.ScaleScreen + nInc
  384.         End If
  385.     End If
  386.     SetScaleProps
  387. End Sub
  388. Private Sub cmdBC_Click()
  389.     Picbuf1.BackColor = GetColor(CommonDialog)
  390.     Shape1.BackColor = Picbuf1.BackColor
  391. End Sub
  392. Private Sub cmdFC_Click()
  393.     Picbuf1.ForeColor = GetColor(CommonDialog)
  394.     Shape2.BackColor = Picbuf1.ForeColor
  395. End Sub
  396. Private Sub Form_Load()
  397.     Picbuf1.DrawWidth = 1
  398.     txtDW.Text = Str$(Picbuf1.DrawWidth)
  399.     Picbuf1.RasterOp = RONOT
  400.     nInc = 5
  401.     nUpdateOption = 0 ' Select Properties the default
  402.     InitPicbuf Picbuf1, True
  403.     Picbuf1.Init 8, 200, 200, RGB(255, 255, 255)
  404.     ' Colors
  405.     Picbuf1.BackColor = RGB(255, 0, 0)
  406.     Picbuf1.ForeColor = RGB(0, 0, 0)
  407.     Shape1.BackColor = Picbuf1.BackColor
  408.     Shape2.BackColor = Picbuf1.ForeColor
  409.     ' RasterOp
  410.     InitcmbRasterOp cmbRO, Picbuf1.RasterOp
  411.     'Init the Scale properties
  412.     SetScaleProps
  413.     'Init the Select properties
  414.     SetSelectProps
  415.     'Init the Print properties
  416.     SetPrintProps
  417. End Sub
  418. Private Sub mnuExit_Click()
  419.     ExitProgram
  420. End Sub
  421. Private Sub mnuFileOpen24BitRGB_Click()
  422.     InitPicbuf Picbuf1, True, "Rgb24.bmp"
  423. End Sub
  424. Private Sub mnuFileOpen24BitWhite_Click()
  425.     InitPicbuf Picbuf1, True, "White24.bmp"
  426. End Sub
  427. Private Sub mnuFileOpen8BitRGB_Click()
  428.     InitPicbuf Picbuf1, True, "Rgb8.bmp"
  429. End Sub
  430. Private Sub mnuFileOpen8BitWhite_Click()
  431.     InitPicbuf Picbuf1, True, "White8.bmp"
  432. End Sub
  433. Private Sub mnuLoad_Click()
  434.     LoadImage Picbuf1, CommonDialog
  435. End Sub
  436. Private Sub mnuSave_Click()
  437.     SaveImage Picbuf1, CommonDialog
  438. End Sub
  439. Private Sub mnuUpdatePrnP_Click()
  440.     ToggleUpdateMenu
  441. End Sub
  442. Private Sub mnuUpdateSelP_Click()
  443.     ToggleUpdateMenu
  444. End Sub
  445. Private Sub mnuZoomIn_Click()
  446.     Zoom 0
  447. End Sub
  448. Private Sub mnuZoomOut_Click()
  449.     Zoom 1
  450. End Sub
  451. ' Capture the mouse and update the
  452. ' Select or Print Properties
  453. Private Sub Picbuf1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  454.     ' what to update
  455.     Dim nOption As Integer
  456.     If mnuUpdateSelP.Checked = True Then
  457.         nOption = RTSelect
  458.     Else
  459.         nOption = RTPrint
  460.     End If
  461.     ' update draw width & raster operations
  462.     SetDraw
  463.         
  464.     ' update
  465.     Picbuf1.RegionRb nOption
  466. End Sub
  467. ' Update Select or Print Values
  468. Private Sub Picbuf1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  469.         If mnuUpdateSelP.Checked = True Then
  470.         SetSelectProps
  471.     Else
  472.         SetPrintProps
  473.     End If
  474. End Sub
  475.