home *** CD-ROM | disk | FTP | other *** search
/ ActiveX Programming Unleashed CD / AXU.iso / componen / vsocx / demo / frmabout.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-04-04  |  4.1 KB  |  117 lines

  1. VERSION 2.00
  2. Begin Form frmAbout 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "About the Demo"
  6.    ClientHeight    =   3795
  7.    ClientLeft      =   2265
  8.    ClientTop       =   1650
  9.    ClientWidth     =   5595
  10.    Height          =   4200
  11.    Left            =   2205
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   3795
  16.    ScaleWidth      =   5595
  17.    Top             =   1305
  18.    Width           =   5715
  19.    Begin TextBox txtAbout 
  20.       FontBold        =   0   'False
  21.       FontItalic      =   0   'False
  22.       FontName        =   "MS Sans Serif"
  23.       FontSize        =   8.25
  24.       FontStrikethru  =   0   'False
  25.       FontUnderline   =   0   'False
  26.       ForeColor       =   &H00800000&
  27.       Height          =   3015
  28.       Left            =   120
  29.       MultiLine       =   -1  'True
  30.       ScrollBars      =   2  'Vertical
  31.       TabIndex        =   1
  32.       Text            =   "This demonstration program is part of the ""Visual Basic Controls Gigabible"" Examples disk."
  33.       Top             =   180
  34.       Width           =   5355
  35.    End
  36.    Begin CommandButton btnOK 
  37.       Cancel          =   -1  'True
  38.       Caption         =   "&OK"
  39.       Default         =   -1  'True
  40.       Height          =   375
  41.       Left            =   2280
  42.       TabIndex        =   0
  43.       Top             =   3300
  44.       Width           =   1095
  45.    End
  46. Option Explicit
  47. ' Color Constants
  48. Const DARK_GRAY = &H808080
  49. Const WHITE = &HFFFFFF
  50. Const BLACK = &H0
  51. ' Maximum allowable title string length
  52. Const MAX_TITLE_LEN = 80
  53. Sub btnOK_Click ()
  54. '--------------------------------------------------
  55. ' Close the About window.
  56. '--------------------------------------------------
  57.     Unload Me
  58. End Sub
  59. Sub Form_Load ()
  60. '--------------------------------------------------
  61. ' Try to read the text file "frmabout.txt" in the
  62. ' application's subdirectory and display its contents
  63. ' in the about box.  Use the first line as the
  64. ' About window caption.
  65. '--------------------------------------------------
  66. Dim FileName As String
  67. Dim fnum As Integer
  68. Dim InText As String
  69. Dim pos As Integer
  70.     On Error Resume Next
  71.     ' Build the file name.
  72.     FileName = App.Path
  73.     If Right$(FileName, 1) <> "\" Then FileName = FileName & "\"
  74.     FileName = FileName & "frmabout.txt"
  75.     ' Read in the file.
  76.     fnum = FreeFile
  77.     Open FileName For Input As fnum
  78.     InText = Input$(FileLen(FileName), fnum)
  79.     ' Load the text into the caption and text control.
  80.     pos = InStr(InText, Chr$(13) & Chr$(10))
  81.     If (pos < MAX_TITLE_LEN) And (pos > 0) Then
  82.         Me.Caption = Left$(InText, pos - 1)
  83.         txtAbout.Text = Mid$(InText, pos + 2)
  84.     ElseIf pos > 0 Then
  85.         Me.Caption = "About the " & App.Title & " Demo"
  86.         txtAbout.Text = InText
  87.     End If
  88.     ' Center the form.
  89.     Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
  90. End Sub
  91. Sub Form_Paint ()
  92. '--------------------------------------------------
  93. ' Paint the 3D effect arounf the text box.
  94. '--------------------------------------------------
  95.     Make3D Me, txtAbout
  96. End Sub
  97. Sub Make3D (pic As Form, ctl As Control)
  98. '--------------------------------------------------
  99. ' Wrap a 3D effect around a control on a form.
  100. '--------------------------------------------------
  101. Dim AdjustX As Integer, AdjustY As Integer
  102. Dim RightSide As Single
  103.     AdjustX = Screen.TwipsPerPixelX
  104.     AdjustY = Screen.TwipsPerPixelY
  105.     ' Set the top shading line.
  106.     pic.Line (ctl.Left - AdjustX, ctl.Top - AdjustY)-(ctl.Left + ctl.Width, ctl.Top - AdjustY), DARK_GRAY
  107.     pic.Line -(ctl.Left + ctl.Width, ctl.Top + ctl.Height), WHITE
  108.     pic.Line -(ctl.Left - AdjustX, ctl.Top + ctl.Height), WHITE
  109.     pic.Line -(ctl.Left - AdjustX, ctl.Top - AdjustY), DARK_GRAY
  110. End Sub
  111. Sub txtAbout_KeyPress (KeyAscii As Integer)
  112. '--------------------------------------------------
  113. ' Prevent accidental editing of help text.
  114. '--------------------------------------------------
  115.     KeyAscii = 0
  116. End Sub
  117.