home *** CD-ROM | disk | FTP | other *** search
/ ActiveX Programming Unleashed CD / AXU.iso / componen / vsocx / demo / function.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-01-10  |  3.7 KB  |  127 lines

  1. VERSION 2.00
  2. Begin Form fFunction 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "VSAwk Function Evaluator App"
  5.    ClientHeight    =   4245
  6.    ClientLeft      =   1245
  7.    ClientTop       =   1605
  8.    ClientWidth     =   5325
  9.    Height          =   4710
  10.    Left            =   1155
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4245
  13.    ScaleWidth      =   5325
  14.    Top             =   1230
  15.    Width           =   5505
  16.    Begin VideoSoftAwk VSAwk1 
  17.       ConvInfo        =   FUNCTION.FRX:0000
  18.       FS              =   " ,    "
  19.       Left            =   0
  20.       Top             =   3270
  21.    End
  22.    Begin VideoSoftElastic VSElastic1 
  23.       Align           =   5  'Fill Container
  24.       AutoSizeChildren=   1  'Even Horizontal
  25.       BevelInner      =   7  'Shadow
  26.       BevelInnerWidth =   4
  27.       BevelOuter      =   1  'Raised
  28.       BevelOuterWidth =   1
  29.       BorderWidth     =   20
  30.       ConvInfo        =   FUNCTION.FRX:000B
  31.       Height          =   3540
  32.       IntBkg          =   &H00C0C0C0&
  33.       Left            =   0
  34.       TabIndex        =   0
  35.       Top             =   705
  36.       Width           =   5325
  37.       Begin GRAPH Graph1 
  38.          AsciiColor      =   "1"
  39.          AutoInc         =   0  'Off
  40.          GraphType       =   6  'Line
  41.          Height          =   2940
  42.          IndexStyle      =   1  'Enhanced
  43.          Left            =   300
  44.          NumPoints       =   30
  45.          TabIndex        =   2
  46.          Top             =   300
  47.          Width           =   4725
  48.       End
  49.    End
  50.    Begin VideoSoftElastic VSElastic2 
  51.       Align           =   1  'Top
  52.       AutoSizeChildren=   3  'Even Vertical
  53.       BevelOuter      =   1  'Raised
  54.       BevelOuterWidth =   1
  55.       BorderWidth     =   12
  56.       CaptionPos      =   7  'Right Center
  57.       ConvInfo        =   FUNCTION.FRX:0016
  58.       FontBold        =   0   'False
  59.       FontItalic      =   0   'False
  60.       FontName        =   "Arial"
  61.       FontSize        =   9.75
  62.       FontStrikethru  =   0   'False
  63.       FontUnderline   =   0   'False
  64.       Height          =   705
  65.       IntBkg          =   &H00C0C0C0&
  66.       Left            =   0
  67.       TabIndex        =   1
  68.       TagWidth        =   600
  69.       Top             =   0
  70.       Width           =   5325
  71.       Begin ComboBox Combo1 
  72.          BackColor       =   &H00C0C0C0&
  73.          FontBold        =   0   'False
  74.          FontItalic      =   0   'False
  75.          FontName        =   "Arial"
  76.          FontSize        =   9.75
  77.          FontStrikethru  =   0   'False
  78.          FontUnderline   =   0   'False
  79.          Height          =   360
  80.          Left            =   780
  81.          TabIndex        =   3
  82.          Tag             =   "f(x) = "
  83.          Text            =   "Combo1"
  84.          Top             =   180
  85.          Width           =   4365
  86.       End
  87.    End
  88. Option Explicit
  89. Dim x!
  90. Sub Combo1_Click ()
  91.   GraphFunction
  92. End Sub
  93. Sub Combo1_KeyPress (KeyAscii As Integer)
  94.   If KeyAscii = 13 Then GraphFunction
  95. End Sub
  96. Sub Form_Load ()
  97.   Combo1.AddItem "X^2"
  98.   Combo1.AddItem "X^3"
  99.   Combo1.AddItem "sin(X)*X^2"
  100.   Combo1.AddItem "tan(x)"
  101.   Combo1.ListIndex = 1
  102. End Sub
  103. Sub GraphFunction ()
  104.   Dim np%, nerr%
  105.   Dim x1!, x2!
  106.   x1 = -10
  107.   x2 = 10
  108.   VSAwk1 = Combo1
  109.   For x = x1 To x2 Step (x2 - x1) / Graph1.NumPoints
  110.     np = np + 1
  111.     If np <= Graph1.NumPoints Then
  112.       Graph1.ThisPoint = np
  113.       Graph1.XPosData = x
  114.       Graph1.GraphData = VSAwk1.Val
  115.       If VSAwk1.Error Then nerr = nerr + 1
  116.     End If
  117.   Next
  118.   Graph1.DrawMode = 2
  119.   If nerr Then Beep
  120. End Sub
  121. Sub VSAwk1_Variable (Variable As String, Value As Single, Accept As Integer)
  122.   If Variable = "X" Or Variable = "x" Then
  123.      Accept = True
  124.      Value = x
  125.   End If
  126. End Sub
  127.