home *** CD-ROM | disk | FTP | other *** search
/ Gurewich OLE Controls for Visual Basic 4 / Gurewich OLE Controls for Visual Basic 4.iso / ocxprog / programs / ch15 / wingapi.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-08-24  |  4.9 KB  |  153 lines

  1. VERSION 4.00
  2. Begin VB.Form frmWinGAPI 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "The WinG API Program"
  5.    ClientHeight    =   4230
  6.    ClientLeft      =   945
  7.    ClientTop       =   1800
  8.    ClientWidth     =   7005
  9.    Height          =   4920
  10.    Icon            =   "WINGAPI.frx":0000
  11.    Left            =   885
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   282
  15.    ScaleMode       =   3  'Pixel
  16.    ScaleWidth      =   467
  17.    Top             =   1170
  18.    Width           =   7125
  19.    Begin VB.Label lblInstructions 
  20.       Caption         =   "To draw and move a red circle inside this window, drag the mouse over this window."
  21.       Enabled         =   0   'False
  22.       BeginProperty Font 
  23.          name            =   "MS Sans Serif"
  24.          charset         =   0
  25.          weight          =   400
  26.          size            =   12
  27.          underline       =   0   'False
  28.          italic          =   0   'False
  29.          strikethrough   =   0   'False
  30.       EndProperty
  31.       ForeColor       =   &H00000000&
  32.       Height          =   615
  33.       Left            =   1080
  34.       TabIndex        =   0
  35.       Top             =   600
  36.       Width           =   4815
  37.    End
  38.    Begin TegwingLibCtl.Tegwing Tegwing1 
  39.       Left            =   2880
  40.       Top             =   1560
  41.       _version        =   65536
  42.       _extentx        =   1032
  43.       _extenty        =   953
  44.       _stockprops     =   0
  45.    End
  46.    Begin VB.Menu mnuFile 
  47.       Caption         =   "&File"
  48.       Begin VB.Menu mnuExit 
  49.          Caption         =   "E&xit"
  50.       End
  51.    End
  52.    Begin VB.Menu mnuHelp 
  53.       Caption         =   "&Help"
  54.       Begin VB.Menu mnuAbout 
  55.          Caption         =   "&About..."
  56.       End
  57.    End
  58. Attribute VB_Name = "frmWinGAPI"
  59. Attribute VB_Creatable = False
  60. Attribute VB_Exposed = False
  61. ' All variables must be declared.
  62. Option Explicit
  63. ' Constants used for drawing.
  64. Const PS_SOLID = 0
  65. Const PS_DASH = 1
  66. Const PS_DOT = 2
  67. Const PS_DASHDOT = 3
  68. Const PS_DASHDOTDOT = 4
  69. Const PS_NULL = 5
  70. Const PS_INSIDEFRAME = 6
  71. Private Sub Form_Load()
  72. ' Set the scale mode to units of Pixels.
  73. Me.ScaleMode = 3
  74. ' Tell the WinG control in which window to draw.
  75. Tegwing1.hWndDisplay = Me.hWnd
  76. ' Open a WinG session
  77. Tegwing1.OpenWinG
  78. ' Disable the Instructions label.
  79. lblInstructions.Enabled = False
  80. End Sub
  81. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  82. Dim RectWidth, RectHeight
  83. Dim Dummy
  84. ' Draw the white rectangle inside WinG
  85. Tegwing1.SetPen PS_SOLID, 1, RGB(255, 255, 255)
  86. Tegwing1.SetSolidBrush RGB(255, 255, 255)
  87. RectWidth = Tegwing1.WinGWidth
  88. RectHeight = Tegwing1.WinGHeight
  89. Tegwing1.DrawRectangle 0, 0, RectWidth - 1, RectHeight - 1
  90. ' Draw a red circle inside WinG
  91. Tegwing1.SetSolidBrush RGB(255, 0, 0)
  92. Dummy = Ellipse(Tegwing1.WinGDC, _
  93.                 X - 50, _
  94.                 Y - 50, _
  95.                 X + 50, _
  96.                 Y + 50)
  97. ' Slam WinG into the screen.
  98. Tegwing1.SlamIt
  99. End Sub
  100. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  101. ' If the mouse button is not pressed, terminate
  102. ' this procedure.
  103. If Button = 0 Then Exit Sub
  104. ' Call the Form_MouseDown() procedure.
  105. Form_MouseDown Button, Shift, X, Y
  106. End Sub
  107. Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  108.         
  109. ' Clear the screen.
  110. Me.Cls
  111. End Sub
  112. Private Sub Form_Unload(Cancel As Integer)
  113.    ' Close the WinG session
  114.    Tegwing1.CloseWinG
  115. End Sub
  116. Private Sub mnuAbout_Click()
  117.    Dim Title
  118.    Dim Msg
  119.    Dim CR
  120.    CR = Chr(13) + Chr(10)
  121.    ' The title of the About message box.
  122.    Title = "About the WinG API Program"
  123.    ' Prepare the message of the About message box.
  124.    Msg = "This program was written with Visual "
  125.    Msg = Msg + "Basic for Windows, using the "
  126.    Msg = Msg + "TegoSoft WinG OCX control. "
  127.    Msg = Msg + CR + CR
  128.    Msg = Msg + "The TegoSoft WinG OCX control "
  129.    Msg = Msg + "enables you to perform fast graphics "
  130.    Msg = Msg + "operations (such as display BMP files) "
  131.    Msg = Msg + "using WinG technology."
  132.    Msg = Msg + CR + CR
  133.    Msg = Msg + "The TegoSoft WinG OCX control "
  134.    Msg = Msg + "is part of the TegoSoft OCX Control "
  135.    Msg = Msg + "Kit - a collection of various OCX controls. "
  136.    Msg = Msg + CR + CR
  137.    Msg = Msg + "For more information about the "
  138.    Msg = Msg + "TegoSoft OCX Control Kit, contact TegoSoft "
  139.    Msg = Msg + "at:"
  140.    Msg = Msg + CR + CR
  141.    Msg = Msg + "TegoSoft Inc." + CR
  142.    Msg = Msg + "P.O. Box 389" + CR
  143.    Msg = Msg + "Bellmore, NY 11710"
  144.    Msg = Msg + CR + CR
  145.    Msg = Msg + "Phone: (516)783-4824"
  146.    ' Display the About message box.
  147.    MsgBox Msg, vbInformation, Title
  148. End Sub
  149. Private Sub mnuExit_Click()
  150. ' Terminate the program.
  151. Unload Me
  152. End Sub
  153.