home *** CD-ROM | disk | FTP | other *** search
/ ActiveX Programming Unleashed CD / AXU.iso / activex / demos / oletrial / samples / vb / mhmult / mhmulti.frm (.txt) next >
Encoding:
Visual Basic Form  |  1995-11-09  |  17.6 KB  |  516 lines

  1. VERSION 4.00
  2. Begin VB.Form fMhMultiple 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Form1"
  5.    ClientHeight    =   4272
  6.    ClientLeft      =   2616
  7.    ClientTop       =   1608
  8.    ClientWidth     =   3276
  9.    BeginProperty Font 
  10.       name            =   "MS Sans Serif"
  11.       charset         =   0
  12.       weight          =   700
  13.       size            =   7.8
  14.       underline       =   0   'False
  15.       italic          =   0   'False
  16.       strikethrough   =   0   'False
  17.    EndProperty
  18.    ForeColor       =   &H80000008&
  19.    Height          =   4644
  20.    Left            =   2568
  21.    LinkTopic       =   "Form1"
  22.    ScaleHeight     =   4272
  23.    ScaleWidth      =   3276
  24.    Top             =   1284
  25.    Width           =   3372
  26.    Begin VB.PictureBox Picture2 
  27.       BorderStyle     =   0  'None
  28.       BeginProperty Font 
  29.          name            =   "MS Sans Serif"
  30.          charset         =   0
  31.          weight          =   700
  32.          size            =   7.8
  33.          underline       =   0   'False
  34.          italic          =   0   'False
  35.          strikethrough   =   0   'False
  36.       EndProperty
  37.       Height          =   615
  38.       Left            =   0
  39.       ScaleHeight     =   612
  40.       ScaleWidth      =   3372
  41.       TabIndex        =   11
  42.       Top             =   3720
  43.       Width           =   3375
  44.       Begin MhmultiLib.MhMultiple MhMultiple2 
  45.          Height          =   495
  46.          Index           =   6
  47.          Left            =   2880
  48.          TabIndex        =   18
  49.          Top             =   0
  50.          Width           =   375
  51.          _Version        =   65536
  52.          _ExtentX        =   661
  53.          _ExtentY        =   873
  54.          _StockProps     =   65
  55.          BackColor       =   -2147483643
  56.          TintColor       =   16711935
  57.          Value           =   0
  58.          Style           =   0
  59.          Autosize        =   0   'False
  60.          AutoSwitch      =   0
  61.          Edges           =   0   'False
  62.       End
  63.       Begin MhmultiLib.MhMultiple MhMultiple2 
  64.          Height          =   495
  65.          Index           =   5
  66.          Left            =   2400
  67.          TabIndex        =   17
  68.          Top             =   0
  69.          Width           =   375
  70.          _Version        =   65536
  71.          _ExtentX        =   661
  72.          _ExtentY        =   873
  73.          _StockProps     =   65
  74.          BackColor       =   -2147483643
  75.          TintColor       =   16711935
  76.          Value           =   0
  77.          Style           =   0
  78.          Autosize        =   0   'False
  79.          AutoSwitch      =   0
  80.          Edges           =   0   'False
  81.       End
  82.       Begin MhmultiLib.MhMultiple MhMultiple2 
  83.          Height          =   495
  84.          Index           =   4
  85.          Left            =   1920
  86.          TabIndex        =   16
  87.          Top             =   0
  88.          Width           =   375
  89.          _Version        =   65536
  90.          _ExtentX        =   661
  91.          _ExtentY        =   873
  92.          _StockProps     =   65
  93.          BackColor       =   -2147483643
  94.          TintColor       =   16711935
  95.          Value           =   0
  96.          Style           =   0
  97.          Autosize        =   0   'False
  98.          AutoSwitch      =   0
  99.          Edges           =   0   'False
  100.       End
  101.       Begin MhmultiLib.MhMultiple MhMultiple2 
  102.          Height          =   495
  103.          Index           =   3
  104.          Left            =   1440
  105.          TabIndex        =   15
  106.          Top             =   0
  107.          Width           =   375
  108.          _Version        =   65536
  109.          _ExtentX        =   661
  110.          _ExtentY        =   873
  111.          _StockProps     =   65
  112.          BackColor       =   -2147483643
  113.          TintColor       =   16711935
  114.          Value           =   0
  115.          Style           =   0
  116.          Autosize        =   0   'False
  117.          AutoSwitch      =   0
  118.          Edges           =   0   'False
  119.       End
  120.       Begin MhmultiLib.MhMultiple MhMultiple2 
  121.          Height          =   495
  122.          Index           =   2
  123.          Left            =   960
  124.          TabIndex        =   14
  125.          Top             =   0
  126.          Width           =   375
  127.          _Version        =   65536
  128.          _ExtentX        =   661
  129.          _ExtentY        =   873
  130.          _StockProps     =   65
  131.          BackColor       =   -2147483643
  132.          TintColor       =   16711935
  133.          Value           =   0
  134.          Style           =   0
  135.          Autosize        =   0   'False
  136.          AutoSwitch      =   0
  137.          Edges           =   0   'False
  138.       End
  139.       Begin MhmultiLib.MhMultiple MhMultiple2 
  140.          Height          =   495
  141.          Index           =   1
  142.          Left            =   480
  143.          TabIndex        =   13
  144.          Top             =   0
  145.          Width           =   375
  146.          _Version        =   65536
  147.          _ExtentX        =   661
  148.          _ExtentY        =   873
  149.          _StockProps     =   65
  150.          BackColor       =   -2147483643
  151.          TintColor       =   16711935
  152.          Value           =   0
  153.          Style           =   0
  154.          Autosize        =   0   'False
  155.          AutoSwitch      =   0
  156.          Edges           =   0   'False
  157.       End
  158.       Begin MhmultiLib.MhMultiple MhMultiple2 
  159.          Height          =   495
  160.          Index           =   0
  161.          Left            =   0
  162.          TabIndex        =   12
  163.          Top             =   0
  164.          Width           =   375
  165.          _Version        =   65536
  166.          _ExtentX        =   661
  167.          _ExtentY        =   873
  168.          _StockProps     =   65
  169.          BackColor       =   -2147483643
  170.          TintColor       =   16711935
  171.          Value           =   0
  172.          Style           =   0
  173.          Autosize        =   0   'False
  174.          AutoSwitch      =   0
  175.          Edges           =   0   'False
  176.       End
  177.    End
  178.    Begin VB.CommandButton cmdValue 
  179.       Appearance      =   0  'Flat
  180.       BackColor       =   &H80000005&
  181.       Caption         =   "Command1"
  182.       BeginProperty Font 
  183.          name            =   "MS Sans Serif"
  184.          charset         =   0
  185.          weight          =   700
  186.          size            =   7.8
  187.          underline       =   0   'False
  188.          italic          =   0   'False
  189.          strikethrough   =   0   'False
  190.       EndProperty
  191.       Height          =   372
  192.       Index           =   3
  193.       Left            =   2520
  194.       TabIndex        =   4
  195.       Top             =   960
  196.       Width           =   492
  197.    End
  198.    Begin VB.CommandButton cmdValue 
  199.       Appearance      =   0  'Flat
  200.       BackColor       =   &H80000005&
  201.       Caption         =   "Command1"
  202.       BeginProperty Font 
  203.          name            =   "MS Sans Serif"
  204.          charset         =   0
  205.          weight          =   700
  206.          size            =   7.8
  207.          underline       =   0   'False
  208.          italic          =   0   'False
  209.          strikethrough   =   0   'False
  210.       EndProperty
  211.       Height          =   372
  212.       Index           =   2
  213.       Left            =   1800
  214.       TabIndex        =   3
  215.       Top             =   960
  216.       Width           =   492
  217.    End
  218.    Begin VB.CommandButton cmdValue 
  219.       Appearance      =   0  'Flat
  220.       BackColor       =   &H80000005&
  221.       Caption         =   "Command1"
  222.       BeginProperty Font 
  223.          name            =   "MS Sans Serif"
  224.          charset         =   0
  225.          weight          =   700
  226.          size            =   7.8
  227.          underline       =   0   'False
  228.          italic          =   0   'False
  229.          strikethrough   =   0   'False
  230.       EndProperty
  231.       Height          =   372
  232.       Index           =   1
  233.       Left            =   1080
  234.       TabIndex        =   2
  235.       Top             =   960
  236.       Width           =   492
  237.    End
  238.    Begin VB.CommandButton cmdValue 
  239.       Appearance      =   0  'Flat
  240.       BackColor       =   &H80000005&
  241.       Caption         =   "Command1"
  242.       BeginProperty Font 
  243.          name            =   "MS Sans Serif"
  244.          charset         =   0
  245.          weight          =   700
  246.          size            =   7.8
  247.          underline       =   0   'False
  248.          italic          =   0   'False
  249.          strikethrough   =   0   'False
  250.       EndProperty
  251.       Height          =   372
  252.       Index           =   0
  253.       Left            =   360
  254.       TabIndex        =   1
  255.       Top             =   960
  256.       Width           =   492
  257.    End
  258.    Begin VB.PictureBox Picture1 
  259.       BeginProperty Font 
  260.          name            =   "MS Sans Serif"
  261.          charset         =   0
  262.          weight          =   700
  263.          size            =   7.8
  264.          underline       =   0   'False
  265.          italic          =   0   'False
  266.          strikethrough   =   0   'False
  267.       EndProperty
  268.       Height          =   612
  269.       Left            =   360
  270.       ScaleHeight     =   564
  271.       ScaleWidth      =   2604
  272.       TabIndex        =   0
  273.       Top             =   252
  274.       Width           =   2652
  275.       Begin MhmultiLib.MhMultiple MhMultiple1 
  276.          Height          =   372
  277.          Index           =   4
  278.          Left            =   2052
  279.          TabIndex        =   10
  280.          Top             =   72
  281.          Width           =   372
  282.          _Version        =   65536
  283.          _ExtentX        =   661
  284.          _ExtentY        =   661
  285.          _StockProps     =   65
  286.          BackColor       =   -2147483643
  287.          TintColor       =   16711935
  288.          Value           =   0
  289.          Style           =   0
  290.          Autosize        =   0   'False
  291.          AutoSwitch      =   0
  292.          Edges           =   0   'False
  293.       End
  294.       Begin MhmultiLib.MhMultiple MhMultiple1 
  295.          Height          =   420
  296.          Index           =   3
  297.          Left            =   1440
  298.          TabIndex        =   9
  299.          Top             =   108
  300.          Width           =   372
  301.          _Version        =   65536
  302.          _ExtentX        =   656
  303.          _ExtentY        =   741
  304.          _StockProps     =   65
  305.          BackColor       =   -2147483643
  306.          TintColor       =   16711935
  307.          Value           =   0
  308.          Style           =   0
  309.          Autosize        =   0   'False
  310.          AutoSwitch      =   0
  311.          Edges           =   0   'False
  312.       End
  313.       Begin MhmultiLib.MhMultiple MhMultiple1 
  314.          Height          =   132
  315.          Index           =   2
  316.          Left            =   1080
  317.          TabIndex        =   8
  318.          Top             =   180
  319.          Width           =   132
  320.          _Version        =   65536
  321.          _ExtentX        =   238
  322.          _ExtentY        =   238
  323.          _StockProps     =   65
  324.          BackColor       =   -2147483643
  325.          TintColor       =   16711935
  326.          Value           =   0
  327.          Style           =   0
  328.          Autosize        =   0   'False
  329.          AutoSwitch      =   0
  330.          Edges           =   0   'False
  331.       End
  332.       Begin MhmultiLib.MhMultiple MhMultiple1 
  333.          Height          =   375
  334.          Index           =   1
  335.          Left            =   600
  336.          TabIndex        =   7
  337.          Top             =   120
  338.          Width           =   255
  339.          _Version        =   65536
  340.          _ExtentX        =   450
  341.          _ExtentY        =   661
  342.          _StockProps     =   65
  343.          BackColor       =   -2147483643
  344.          TintColor       =   16711935
  345.          Value           =   0
  346.          Style           =   0
  347.          Autosize        =   0   'False
  348.          AutoSwitch      =   0
  349.          Edges           =   0   'False
  350.       End
  351.       Begin MhmultiLib.MhMultiple MhMultiple1 
  352.          Height          =   375
  353.          Index           =   0
  354.          Left            =   120
  355.          TabIndex        =   6
  356.          Top             =   120
  357.          Width           =   255
  358.          _Version        =   65536
  359.          _ExtentX        =   450
  360.          _ExtentY        =   661
  361.          _StockProps     =   65
  362.          BackColor       =   -2147483643
  363.          TintColor       =   16711935
  364.          Value           =   0
  365.          Style           =   0
  366.          Autosize        =   0   'False
  367.          AutoSwitch      =   0
  368.          Edges           =   0   'False
  369.       End
  370.    End
  371.    Begin MhtimerLib.MhTimer MhTimer1 
  372.       Height          =   336
  373.       Left            =   0
  374.       TabIndex        =   19
  375.       Top             =   3240
  376.       Width           =   336
  377.       _Version        =   65536
  378.       _ExtentX        =   593
  379.       _ExtentY        =   593
  380.       _StockProps     =   64
  381.       TintColor       =   16711935
  382.       Interval        =   0
  383.    End
  384.    Begin VB.Label lblXplain 
  385.       Caption         =   "Label1"
  386.       BeginProperty Font 
  387.          name            =   "MS Sans Serif"
  388.          charset         =   0
  389.          weight          =   700
  390.          size            =   7.8
  391.          underline       =   0   'False
  392.          italic          =   0   'False
  393.          strikethrough   =   0   'False
  394.       EndProperty
  395.       Height          =   2175
  396.       Left            =   360
  397.       TabIndex        =   5
  398.       Top             =   1440
  399.       Width           =   2655
  400.    End
  401. Attribute VB_Name = "fMhMultiple"
  402. Attribute VB_Creatable = False
  403. Attribute VB_Exposed = False
  404. Option Explicit
  405. Const im_NONE = 0
  406. Const im_TRUE = -1, im_FALSE = 0
  407. Const im_LIGHT = 0, im_BIGBUTTON = 1, im_TINYBUTTON = 2, im_SWITCH = 3, im_FACES = 4
  408. Const im_RED = 0, im_YELLOW = 1, im_GREEN = 2, im_GRAY = 3
  409. Const im_LEAD = 0, im_STATE = 1, im_COLOR = 2
  410. Private Sub cmdValue_Click(Index As Integer)
  411. 'Set values for MhMultiples
  412.     Dim iIndex As Integer
  413.     For iIndex = 0 To 4
  414.         MhMultiple1(iIndex).Value = Index
  415.     Next
  416.     lblXplain.Caption = Xplain(im_STATE)
  417. End Sub
  418. Private Sub Form_Load()
  419. 'Because this is an example, everything that isn't
  420. 'explicitly a design-time property will be set in
  421. 'code. This routine sets all the defaults for the
  422. 'app.
  423.     Dim iIndex As Integer
  424.     'Set properties for form
  425.     fMhMultiple.Caption = "MhMultiple Control"
  426.     'Set picture box container properties
  427.     Picture2.BorderStyle = im_NONE
  428.     Picture1.Left = 340
  429.     'Set properties for MhMultiple
  430.     MhMultiple1(1).Style = im_BIGBUTTON
  431.     MhMultiple1(1).Value = im_YELLOW
  432.     MhMultiple1(2).Style = im_TINYBUTTON
  433.     MhMultiple1(2).Value = im_GREEN
  434.     MhMultiple1(3).Style = im_SWITCH
  435.     MhMultiple1(3).Value = im_GREEN
  436.     MhMultiple1(3).Top = MhMultiple1(3).Top - 60
  437.     MhMultiple1(4).Style = im_FACES
  438.     MhMultiple1(4).Value = im_RED
  439.     'Set multiples at bottom of form
  440.     For iIndex = 0 To 6
  441.         MhMultiple2(iIndex).Top = 45
  442.     Next
  443.     For iIndex = 0 To 6
  444.         MhMultiple2(iIndex).Style = im_FACES
  445.     Next
  446.     MhMultiple2(1).Value = im_YELLOW
  447.     MhMultiple2(2).Value = im_GREEN
  448.     MhMultiple2(3).Value = im_GRAY
  449.     MhMultiple2(5).Value = im_YELLOW
  450.     MhMultiple2(6).Value = im_GREEN
  451.     'Set properties for cmdValue
  452.     For iIndex = 0 To 3
  453.         cmdValue(iIndex).Caption = Str$(iIndex + 1)
  454.         cmdValue(iIndex).Left = cmdValue(iIndex).Left - 20
  455.     Next
  456.     'Set timer interval
  457.     MhTimer1.Interval = 500
  458.     'Set properties for label
  459.     lblXplain.WordWrap = True
  460.     lblXplain.Caption = Xplain(im_LEAD)
  461.     ' center form to screen
  462.     Move Abs(Screen.Width - Width) \ 2, Abs(Screen.Height - Height) \ 2
  463. End Sub
  464. Private Sub MhMultiple1_Click(Index As Integer)
  465. 'Cycle through values when clicked on
  466.     If MhMultiple1(Index).Value = im_GRAY Then
  467.         MhMultiple1(Index).Value = im_RED
  468.     Else
  469.         MhMultiple1(Index).Value = MhMultiple1(Index).Value + 1
  470.     End If
  471.     lblXplain.Caption = Xplain(im_COLOR)
  472. End Sub
  473. Private Sub MhMultiple2_Click(Index As Integer)
  474. 'Set the flag to turn the faces at the bottom off
  475. 'if the user gets sick of them
  476.     If MhTimer1.Enabled = True Then
  477.         MhTimer1.Enabled = False
  478.     Else
  479.         MhTimer1.Enabled = True
  480.     End If
  481. End Sub
  482. Private Sub MhTimer1_Timer()
  483. 'This executes routine to make faces change
  484. 'at bottom of form
  485.     'Dimension variables
  486.     Static iActive As Integer
  487.     Static iCurrent As Integer
  488.     Dim iIndex As Integer
  489.     Dim iValue As Integer
  490.     'Avoid recursion, otherwise set flag to true
  491.     If iActive Then Exit Sub
  492.     iActive = im_TRUE
  493.     'Reduce the value for each of the controls
  494.     'If a value is zero, start over at 3
  495.     For iIndex = 0 To 6
  496.         iValue = MhMultiple2(iIndex).Value - 1
  497.         If iValue < 0 Then
  498.             iValue = 3
  499.         End If
  500.         MhMultiple2(iIndex).Value = iValue
  501.     Next
  502.     'Set flag when we exit routine
  503.     iActive = im_FALSE
  504. End Sub
  505. Private Function Xplain(Index As Integer) As String
  506. 'Returns text for label
  507.     Select Case Index
  508.         Case im_LEAD
  509.             Xplain = "When screen real estate is at a premium, programmers can use MhMulti control, a bitmapped button that supports up to four different states. Click on an individual control to cycle through the color-coordinated states or click a button to see what bitmap is associated with that value."
  510.         Case im_STATE
  511.             Xplain = "By giving programmers the choice of four states, MhMulti allows a single button to stand for up to four different conditions, eliminating the need for extra toggle buttons on the form to address separate conditions. You can address multiple conditions with one control."
  512.         Case im_COLOR
  513.             Xplain = "One of the great strengths of MhMulti is that it uses easily understood colors to alert your enduser to the button's value. Because the colors and symbols are easily understood, the learning curve for your program is reduced and users become more productive more quickly."
  514.     End Select
  515. End Function
  516.