home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 5 / MasteringVisualBasic5.iso / olympus / ik32_15t / vb4.shr / Grayneg.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-07-23  |  6.1 KB  |  197 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Grayscale & Negative"
  5.    ClientHeight    =   2895
  6.    ClientLeft      =   1215
  7.    ClientTop       =   1995
  8.    ClientWidth     =   5415
  9.    Height          =   3585
  10.    Left            =   1155
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   2895
  16.    ScaleWidth      =   5415
  17.    Top             =   1365
  18.    Width           =   5535
  19.    Begin VB.CommandButton cmdProcessImage 
  20.       Caption         =   "&Process Image"
  21.       Height          =   375
  22.       Left            =   3480
  23.       TabIndex        =   2
  24.       Top             =   2400
  25.       Width           =   1815
  26.    End
  27.    Begin VB.Frame Frame1 
  28.       Caption         =   "Image Processor"
  29.       Height          =   2295
  30.       Left            =   3480
  31.       TabIndex        =   0
  32.       Top             =   0
  33.       Width           =   1815
  34.       Begin VB.OptionButton optProcessor 
  35.          Caption         =   "Rotate"
  36.          Height          =   255
  37.          Index           =   4
  38.          Left            =   120
  39.          TabIndex        =   9
  40.          Top             =   1680
  41.          Value           =   -1  'True
  42.          Width           =   1095
  43.       End
  44.       Begin VB.OptionButton optProcessor 
  45.          Caption         =   "Vertical Mirror"
  46.          Height          =   255
  47.          Index           =   3
  48.          Left            =   120
  49.          TabIndex        =   8
  50.          Top             =   1320
  51.          Width           =   1575
  52.       End
  53.       Begin VB.OptionButton optProcessor 
  54.          Caption         =   "Horizontal Mirror"
  55.          Height          =   255
  56.          Index           =   2
  57.          Left            =   120
  58.          TabIndex        =   7
  59.          Top             =   960
  60.          Width           =   1575
  61.       End
  62.       Begin VB.OptionButton optProcessor 
  63.          Caption         =   "Negate"
  64.          Height          =   255
  65.          Index           =   1
  66.          Left            =   120
  67.          TabIndex        =   6
  68.          Top             =   600
  69.          Width           =   1095
  70.       End
  71.       Begin VB.TextBox txtDegrees 
  72.          Enabled         =   0   'False
  73.          Height          =   285
  74.          Left            =   1200
  75.          TabIndex        =   3
  76.          Text            =   "txtDegrees"
  77.          Top             =   1920
  78.          Width           =   495
  79.       End
  80.       Begin VB.OptionButton optProcessor 
  81.          Caption         =   "Grayscale"
  82.          Height          =   255
  83.          Index           =   0
  84.          Left            =   120
  85.          TabIndex        =   1
  86.          Top             =   240
  87.          Width           =   1095
  88.       End
  89.       Begin VB.Label Label1 
  90.          Caption         =   "Degree:"
  91.          Height          =   255
  92.          Left            =   555
  93.          TabIndex        =   4
  94.          Top             =   1965
  95.          Width           =   615
  96.       End
  97.    End
  98.    Begin ik32Lib.Picbuf Picbuf1 
  99.       Height          =   2775
  100.       Left            =   120
  101.       TabIndex        =   5
  102.       Top             =   0
  103.       Width           =   3255
  104.       _Version        =   65536
  105.       _ExtentX        =   5741
  106.       _ExtentY        =   4895
  107.       _StockProps     =   253
  108.    End
  109.    Begin MSComDlg.CommonDialog CommonDialog1 
  110.       Left            =   2280
  111.       Top             =   1200
  112.       _Version        =   65536
  113.       _ExtentX        =   847
  114.       _ExtentY        =   847
  115.       _StockProps     =   0
  116.    End
  117.    Begin VB.Menu mnuFile 
  118.       Caption         =   "&File"
  119.       Begin VB.Menu mnuLoad 
  120.          Caption         =   "&Load Image..."
  121.       End
  122.       Begin VB.Menu mnuSaveAs 
  123.          Caption         =   "&Save Image..."
  124.       End
  125.       Begin VB.Menu mnuSpacer 
  126.          Caption         =   "-"
  127.       End
  128.       Begin VB.Menu mnuExit 
  129.          Caption         =   "E&xit"
  130.          Shortcut        =   ^X
  131.       End
  132.    End
  133.    Begin VB.Menu mnuReload 
  134.       Caption         =   "&Reload"
  135.    End
  136. Attribute VB_Name = "Form1"
  137. Attribute VB_Creatable = False
  138. Attribute VB_Exposed = False
  139. Option Explicit
  140. 'Description: This code determines which option
  141. 'button has been chosen, and then performs that
  142. 'designated task
  143. Private Sub cmdProcessImage_Click()
  144.     Select Case True
  145.         Case optProcessor(0).Value
  146.            Picbuf1.GrayScale
  147.         Case optProcessor(1).Value
  148.             Picbuf1.Negate
  149.         Case optProcessor(2).Value
  150.             Picbuf1.Mirror True, False
  151.         Case optProcessor(3).Value
  152.             Picbuf1.Mirror False, True
  153.         Case optProcessor(4).Value
  154.             Picbuf1.Rotate Val(txtDegrees.Text), 0
  155.     End Select
  156. End Sub
  157. 'Description: Here we set all of presets for the
  158. 'picbuf
  159. Private Sub Form_Load()
  160.     'Set PicBuf properties and load images
  161.     InitPicbuf Picbuf1, True, "squirrel.bmp"
  162.     'Init text box, and option button control array
  163.     txtDegrees.Text = "0"
  164.     optProcessor(0).Value = True
  165. End Sub
  166. 'Description: This code ends the program
  167. Private Sub mnuExit_Click()
  168.     ExitProgram
  169. End Sub
  170. 'Description: This code calls a sub which uses the
  171. 'common dialog control to load an image into the
  172. 'picbuf
  173. Private Sub mnuLoad_Click()
  174.     LoadImage Picbuf1, CommonDialog1
  175. End Sub
  176. 'Description: This code calls the PicbufOriginal
  177. 'change event, which reloads the image.Private Sub mnuReload_Click()
  178. Private Sub mnuReload_Click()
  179.     Picbuf1.Load
  180. End Sub
  181. 'Description: Here we call a sub which uses the
  182. 'common dialog control to save an image from the
  183. 'picbuf
  184. Private Sub mnuSaveAs_Click()
  185.     SaveImage Picbuf1, CommonDialog1
  186. End Sub
  187. 'Description: This code disables a text box if the
  188. 'pertaining option button is not chosen.
  189. Private Sub optProcessor_Click(Index As Integer)
  190.     Select Case Index
  191.         Case Is < 4
  192.             txtDegrees.Enabled = False
  193.         Case 4
  194.             txtDegrees.Enabled = True
  195.     End Select
  196. End Sub
  197.