home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual BASIC 5.0 (Ent. Edition) / Vb5ent Extractor.EXE / VB / SAMPLES / PGUIDE / PALMODE / PALETTES.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-09-18  |  4.8 KB  |  151 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "PaletteMode Demo"
  4.    ClientHeight    =   5085
  5.    ClientLeft      =   1860
  6.    ClientTop       =   1530
  7.    ClientWidth     =   6465
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   5085
  10.    ScaleWidth      =   6465
  11.    Begin VB.OptionButton Option1 
  12.       Caption         =   "Custom (Pastel DIB)"
  13.       Height          =   255
  14.       Index           =   3
  15.       Left            =   4440
  16.       TabIndex        =   6
  17.       Top             =   240
  18.       Width           =   1935
  19.    End
  20.    Begin VB.CommandButton cmdQuit 
  21.       Cancel          =   -1  'True
  22.       Caption         =   "Quit"
  23.       Height          =   495
  24.       Left            =   5040
  25.       TabIndex        =   4
  26.       Top             =   4080
  27.       Width           =   1215
  28.    End
  29.    Begin VB.PictureBox Picture1 
  30.       AutoSize        =   -1  'True
  31.       Height          =   3855
  32.       Left            =   240
  33.       ScaleHeight     =   3795
  34.       ScaleWidth      =   4035
  35.       TabIndex        =   3
  36.       Top             =   720
  37.       Width           =   4095
  38.    End
  39.    Begin VB.OptionButton Option1 
  40.       Caption         =   "Custom (Grayscale)"
  41.       Height          =   255
  42.       Index           =   2
  43.       Left            =   2520
  44.       TabIndex        =   2
  45.       Top             =   240
  46.       Width           =   1695
  47.    End
  48.    Begin VB.OptionButton Option1 
  49.       Caption         =   "ZOrder"
  50.       Height          =   255
  51.       Index           =   1
  52.       Left            =   1440
  53.       TabIndex        =   1
  54.       Top             =   240
  55.       Width           =   855
  56.    End
  57.    Begin VB.OptionButton Option1 
  58.       Caption         =   "Halftone"
  59.       Height          =   255
  60.       Index           =   0
  61.       Left            =   240
  62.       TabIndex        =   0
  63.       Top             =   240
  64.       Value           =   -1  'True
  65.       Width           =   1095
  66.    End
  67.    Begin VB.Timer Timer1 
  68.       Interval        =   800
  69.       Left            =   5160
  70.       Top             =   2880
  71.    End
  72.    Begin VB.Label Label1 
  73.       Caption         =   "Note: For full effect, this demo should be run in 256 color mode."
  74.       Height          =   255
  75.       Left            =   240
  76.       TabIndex        =   5
  77.       Top             =   4800
  78.       Width           =   6135
  79.    End
  80.    Begin VB.Image Image1 
  81.       BorderStyle     =   1  'Fixed Single
  82.       Height          =   1290
  83.       Left            =   4680
  84.       Picture         =   "Palettes.frx":0000
  85.       Stretch         =   -1  'True
  86.       Top             =   720
  87.       Width           =   1620
  88.    End
  89. Attribute VB_Name = "Form1"
  90. Attribute VB_GlobalNameSpace = False
  91. Attribute VB_Creatable = False
  92. Attribute VB_TemplateDerived = False
  93. Attribute VB_PredeclaredId = True
  94. Attribute VB_Exposed = False
  95. '// Sample application to demonstrate the PaletteMode ///
  96. '// and Palette properties for forms and controls.    ///
  97. '// Version 1.0 9/16/1996                             ///
  98. '//                                                   ///
  99. '// Note: this sample should be run in 256 color mode ///
  100. '// Palette & PaletteMode have no effect in other     ///
  101. '// color modes.
  102. Option Explicit
  103. Dim objPic As Picture    ' Picture object for option 4.
  104. Private Sub cmdQuit_Click()
  105.     Unload Me
  106. End Sub
  107. Private Sub Form_Load()
  108.     ' Load a 256 color DIB into the picture object
  109.     Set objPic = LoadPicture(App.Path & "\PASTEL.DIB")
  110. End Sub
  111. Private Sub Option1_Click(Index As Integer)
  112.     Timer1.Enabled = False
  113.     Select Case Index
  114.         Case 0
  115.             ' Use the Halftone mode (default).
  116.             Form1.PaletteMode = vbPaletteModeHalftone
  117.         Case 1
  118.             ' Use the palette of the loaded picture -
  119.             ' color "flashing" will result (ZOrder mode).
  120.             Form1.PaletteMode = vbPaletteModeUseZOrder
  121.         Case 2
  122.             'Set Form1.Palette = Nothing
  123.             ' Assign the palette from Image1 to the form.
  124.             Form1.Palette = Image1.Picture
  125.             ' Use the Custom mode.
  126.             Form1.PaletteMode = vbPaletteModeCustom
  127.         Case 3
  128.             'Set Form1.Palette = Nothing
  129.             ' Assign picture object's palette to the form.
  130.             Form1.Palette = objPic
  131.             ' Use the Custom mode.
  132.             Form1.PaletteMode = vbPaletteModeCustom
  133.     End Select
  134.     Picture1.Refresh
  135.     Timer1.Enabled = True
  136. End Sub
  137. Private Sub Timer1_Timer()
  138.     Static intC As Integer
  139.     ' Switch between three different images.
  140.     If intC < 1 Then
  141.         Picture1 = LoadPicture(App.Path & "\BANNER.GIF")
  142.         intC = 1
  143.     ElseIf intC = 1 Then
  144.         Picture1 = LoadPicture(App.Path & "\CLOUDS.BMP")
  145.         intC = 2
  146.     Else
  147.         Picture1 = LoadPicture(App.Path & "\FOREST.JPG")
  148.         intC = 0
  149.     End If
  150. End Sub
  151.