home *** CD-ROM | disk | FTP | other *** search
/ Multimédia la Compil' 2 / Sybex_Multimedia_La_Compil_2.iso / cooltool / 3ddraw.bas next >
BASIC Source File  |  1995-04-20  |  1KB  |  47 lines

  1. Option Explicit
  2.  
  3. Global Const CTLRAISED = 1
  4. Global Const CTLSUNKEN = 2
  5.  
  6.  
  7. Sub HighLight (C As Control, Style As Integer)
  8.     Dim TLShade     As Long
  9.     Dim BRShade     As Long
  10.     Dim i           As Integer
  11.     Dim T, L, W, H  As Integer
  12.     Dim oldScale    As Integer
  13.     '
  14.     ' Save control parent's ScaleMode and change it to Pixel
  15.     '
  16.     oldScale = C.Parent.ScaleMode
  17.     C.Parent.ScaleMode = 3
  18.     '
  19.     ' Initialize shade colors based on Style
  20.     '
  21.     If Style = CTLRAISED Then
  22.        TLShade = RGB(255, 255, 255)
  23.        BRShade = RGB(128, 128, 128)
  24.     Else
  25.        TLShade = RGB(128, 128, 128)
  26.        BRShade = RGB(255, 255, 255)
  27.     End If
  28.     '
  29.     ' Draw two pixel wide shadowed border
  30.     '
  31.     For i = 1 To 1
  32.        T = C.Top - i
  33.        L = C.Left - i
  34.        H = C.Height + 2 * i
  35.        W = C.Width + 2 * i
  36.        '
  37.        ' Draw left, top, right, bottom
  38.        '
  39.        C.Parent.Line (L, T)-Step(0, H), TLShade
  40.        C.Parent.Line (L, T)-Step(W, 0), TLShade
  41.        C.Parent.Line (L + W, T)-Step(0, H), BRShade
  42.        C.Parent.Line (L, T + H)-Step(W, 0), BRShade
  43.     Next i
  44.     C.Parent.ScaleMode = oldScale
  45. End Sub
  46.  
  47.