home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / OldSrc / CH6 / SRC / EASY3D.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-10-29  |  3.1 KB  |  108 lines

  1. VERSION 4.00
  2. Begin VB.Form Easy3DForm 
  3.    AutoRedraw      =   -1  'True
  4.    BackColor       =   &H00C0C0C0&
  5.    Caption         =   "Easy 3D"
  6.    ClientHeight    =   4290
  7.    ClientLeft      =   1860
  8.    ClientTop       =   1650
  9.    ClientWidth     =   4560
  10.    BeginProperty Font 
  11.       name            =   "Times New Roman"
  12.       charset         =   1
  13.       weight          =   700
  14.       size            =   24
  15.       underline       =   0   'False
  16.       italic          =   -1  'True
  17.       strikethrough   =   0   'False
  18.    EndProperty
  19.    Height          =   4980
  20.    Left            =   1800
  21.    LinkTopic       =   "Form1"
  22.    ScaleHeight     =   286
  23.    ScaleMode       =   3  'Pixel
  24.    ScaleWidth      =   304
  25.    Top             =   1020
  26.    Width           =   4680
  27.    Begin VB.PictureBox Picture1 
  28.       AutoRedraw      =   -1  'True
  29.       BackColor       =   &H00FFFF00&
  30.       BorderStyle     =   0  'None
  31.       Height          =   1335
  32.       Left            =   0
  33.       ScaleHeight     =   89
  34.       ScaleMode       =   3  'Pixel
  35.       ScaleWidth      =   305
  36.       TabIndex        =   0
  37.       Top             =   3000
  38.       Width           =   4575
  39.    End
  40.    Begin VB.Menu mnuFile 
  41.       Caption         =   "&File"
  42.       Begin VB.Menu mnuFileExit 
  43.          Caption         =   "E&xit"
  44.       End
  45.    End
  46. Attribute VB_Name = "Easy3DForm"
  47. Attribute VB_Creatable = False
  48. Attribute VB_Exposed = False
  49. Option Explicit
  50. Sub SeparateColor(color As Long, r As Integer, g As Integer, b As Integer)
  51.     r = color Mod 256
  52.     g = color \ 256 Mod 256
  53.     b = color \ 256 \ 256
  54. End Sub
  55. Private Sub Form_Load()
  56. Const txt = "3D text the easy way!"
  57. Const GAP = 1
  58. Dim x As Single
  59. Dim y As Single
  60. Dim r As Integer
  61. Dim g As Integer
  62. Dim b As Integer
  63. Dim oldcolor As Long
  64.     CurrentX = 10
  65.     CurrentY = 10
  66.     Text3d Me, txt, vbBlack, RGB(127, 127, 127), vbWhite
  67.     CurrentX = 10
  68.     Text3d Me, txt, BackColor, vbBlack, vbWhite
  69.     SeparateColor BackColor, r, g, b
  70.     CurrentX = 10
  71.     Text3d Me, txt, BackColor, RGB(r / 2, g / 2, b / 2), vbWhite
  72.     CurrentX = 10
  73.     Text3d Me, txt, vbBlue, vbBlack, vbWhite
  74.     CurrentX = 10
  75.     Text3d Me, txt, Picture1.BackColor, vbBlack, vbWhite
  76.     Picture1.CurrentX = 10
  77.     Picture1.CurrentY = 10
  78.     Text3d Picture1, txt, Picture1.BackColor, vbBlack, vbWhite
  79.     SeparateColor BackColor, r, g, b
  80.     Picture1.CurrentX = 10
  81.     Text3d Picture1, txt, Picture1.BackColor, RGB(r / 2, g / 2, b / 2), vbWhite
  82. End Sub
  83. Sub Text3d(pic As Object, txt As String, fore As Long, shadow As Long, highlight As Long)
  84. Const ADJUST = 1
  85. Dim x As Single
  86. Dim y As Single
  87. Dim oldcolor As Long
  88.     oldcolor = pic.ForeColor
  89.     x = pic.CurrentX
  90.     y = pic.CurrentY
  91.     pic.ForeColor = highlight
  92.     pic.CurrentX = x - ADJUST
  93.     pic.CurrentY = y - ADJUST
  94.     pic.Print txt
  95.     pic.ForeColor = shadow
  96.     pic.CurrentX = x + ADJUST
  97.     pic.CurrentY = y + ADJUST
  98.     pic.Print txt
  99.     pic.ForeColor = fore
  100.     pic.CurrentX = x
  101.     pic.CurrentY = y
  102.     pic.Print txt
  103.     pic.ForeColor = oldcolor
  104. End Sub
  105. Private Sub mnuFileExit_Click()
  106.     Unload Me
  107. End Sub
  108.