home *** CD-ROM | disk | FTP | other *** search
/ ActiveX Programming Unleashed CD / AXU.iso / activex / demos / oletrial / samples / vb / mhcmd / fmh3dcmd.frm (.txt) next >
Encoding:
Visual Basic Form  |  1995-11-28  |  25.5 KB  |  674 lines

  1. VERSION 4.00
  2. Begin VB.Form fMh3dCmd 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   6636
  5.    ClientLeft      =   1716
  6.    ClientTop       =   1872
  7.    ClientWidth     =   5940
  8.    Height          =   7236
  9.    Left            =   1668
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   6636
  12.    ScaleWidth      =   5940
  13.    Top             =   1320
  14.    Width           =   6036
  15.    Begin VB.PictureBox Picture1 
  16.       Height          =   495
  17.       Index           =   2
  18.       Left            =   6720
  19.       Picture         =   "fMh3dCmd.frx":0000
  20.       ScaleHeight     =   444
  21.       ScaleWidth      =   444
  22.       TabIndex        =   3
  23.       Top             =   1320
  24.       Width           =   495
  25.    End
  26.    Begin VB.PictureBox Picture1 
  27.       Height          =   495
  28.       Index           =   1
  29.       Left            =   6720
  30.       Picture         =   "fMh3dCmd.frx":0316
  31.       ScaleHeight     =   444
  32.       ScaleWidth      =   444
  33.       TabIndex        =   2
  34.       Top             =   720
  35.       Width           =   495
  36.    End
  37.    Begin VB.PictureBox Picture1 
  38.       Height          =   495
  39.       Index           =   0
  40.       Left            =   6720
  41.       Picture         =   "fMh3dCmd.frx":0598
  42.       ScaleHeight     =   444
  43.       ScaleWidth      =   444
  44.       TabIndex        =   1
  45.       Top             =   120
  46.       Width           =   495
  47.    End
  48.    Begin Mh3dfrmLibCtl.Mh3dFrame frmStatePicture 
  49.       Height          =   3012
  50.       Left            =   120
  51.       TabIndex        =   5
  52.       Top             =   3456
  53.       Width           =   5652
  54.       _Version        =   65536
  55.       _ExtentX        =   9975
  56.       _ExtentY        =   5318
  57.       _StockProps     =   77
  58.       TintColor       =   16711935
  59.       Alignment       =   0
  60.       AutoSize        =   0   'False
  61.       BevelSize       =   0
  62.       BevelStyle      =   0
  63.       BorderColor     =   -2147483642
  64.       BorderStyle     =   1
  65.       FillColor       =   -2147483633
  66.       FontStyle       =   0
  67.       FontTransparent =   0   'False
  68.       LightColor      =   -2147483643
  69.       ShadowColor     =   -2147483632
  70.       TextColor       =   -2147483640
  71.       WallPaper       =   0
  72.       Picture         =   "fMh3dCmd.frx":081A
  73.       NoPrefix        =   0   'False
  74.       FormatString    =   ""
  75.       Caption         =   "Mh3dFrame1"
  76.       Begin Mh3dcmdLibCtl.Mh3dCommand Mh3dCommand2 
  77.          Height          =   2415
  78.          Left            =   240
  79.          TabIndex        =   9
  80.          Top             =   360
  81.          Width           =   5175
  82.          _Version        =   65536
  83.          _ExtentX        =   9128
  84.          _ExtentY        =   4260
  85.          _StockProps     =   15
  86.          Caption         =   "Mh3dCommand2"
  87.          TintColor       =   16711935
  88.          Alignment       =   2
  89.          AutoSize        =   -1  'True
  90.          BevelSize       =   2
  91.          BorderColor     =   -2147483642
  92.          BorderStyle     =   2
  93.          FillColor       =   -2147483633
  94.          FontTransparent =   -1  'True
  95.          LightColor      =   -2147483628
  96.          PictureDown     =   "fMh3dCmd.frx":0836
  97.          PicturePressed  =   "fMh3dCmd.frx":0852
  98.          PictureUp       =   "fMh3dCmd.frx":086E
  99.          ShadowColor     =   -2147483632
  100.          TextColor       =   -2147483630
  101.          Picture         =   "fMh3dCmd.frx":088A
  102.          BevelStyle      =   1
  103.          MouseIcon       =   "fMh3dCmd.frx":08A6
  104.       End
  105.    End
  106.    Begin Mh3dcmdLibCtl.Mh3dCommand Mh3dCommand1 
  107.       Height          =   1335
  108.       Left            =   120
  109.       TabIndex        =   8
  110.       Top             =   120
  111.       Width           =   5655
  112.       _Version        =   65536
  113.       _ExtentX        =   9975
  114.       _ExtentY        =   2355
  115.       _StockProps     =   15
  116.       Caption         =   "Mh3dCommand1"
  117.       TintColor       =   16711935
  118.       Alignment       =   2
  119.       AutoSize        =   -1  'True
  120.       BevelSize       =   2
  121.       BorderColor     =   -2147483642
  122.       BorderStyle     =   2
  123.       FillColor       =   -2147483633
  124.       FontTransparent =   -1  'True
  125.       LightColor      =   -2147483628
  126.       PictureDown     =   "fMh3dCmd.frx":08C2
  127.       PicturePressed  =   "fMh3dCmd.frx":08DE
  128.       PictureUp       =   "fMh3dCmd.frx":08FA
  129.       ShadowColor     =   -2147483632
  130.       TextColor       =   -2147483630
  131.       Picture         =   "fMh3dCmd.frx":0916
  132.       BevelStyle      =   1
  133.       MouseIcon       =   "fMh3dCmd.frx":0932
  134.    End
  135.    Begin Mh3dcmdLibCtl.Mh3dCommand cmdDecreasePercent 
  136.       Height          =   495
  137.       Left            =   120
  138.       TabIndex        =   7
  139.       Top             =   1560
  140.       Width           =   2775
  141.       _Version        =   65536
  142.       _ExtentX        =   4895
  143.       _ExtentY        =   873
  144.       _StockProps     =   15
  145.       Caption         =   "Mh3dCommand3"
  146.       TintColor       =   16711935
  147.       Alignment       =   2
  148.       AutoSize        =   -1  'True
  149.       BevelSize       =   2
  150.       BorderColor     =   -2147483642
  151.       BorderStyle     =   2
  152.       FillColor       =   -2147483633
  153.       FontTransparent =   -1  'True
  154.       LightColor      =   -2147483628
  155.       PictureDown     =   "fMh3dCmd.frx":094E
  156.       PicturePressed  =   "fMh3dCmd.frx":096A
  157.       PictureUp       =   "fMh3dCmd.frx":0986
  158.       ShadowColor     =   -2147483632
  159.       TextColor       =   -2147483630
  160.       Picture         =   "fMh3dCmd.frx":09A2
  161.       BevelStyle      =   1
  162.       MouseIcon       =   "fMh3dCmd.frx":09BE
  163.    End
  164.    Begin Mh3dcmdLibCtl.Mh3dCommand cmdIncreasePercent 
  165.       Height          =   495
  166.       Left            =   3000
  167.       TabIndex        =   6
  168.       Top             =   1560
  169.       Width           =   2775
  170.       _Version        =   65536
  171.       _ExtentX        =   4895
  172.       _ExtentY        =   873
  173.       _StockProps     =   15
  174.       Caption         =   "Mh3dCommand2"
  175.       TintColor       =   16711935
  176.       Alignment       =   2
  177.       AutoSize        =   -1  'True
  178.       BevelSize       =   2
  179.       BorderColor     =   -2147483642
  180.       BorderStyle     =   2
  181.       FillColor       =   -2147483633
  182.       FontTransparent =   -1  'True
  183.       LightColor      =   -2147483628
  184.       PictureDown     =   "fMh3dCmd.frx":09DA
  185.       PicturePressed  =   "fMh3dCmd.frx":09F6
  186.       PictureUp       =   "fMh3dCmd.frx":0A12
  187.       ShadowColor     =   -2147483632
  188.       TextColor       =   -2147483630
  189.       Picture         =   "fMh3dCmd.frx":0A2E
  190.       BevelStyle      =   1
  191.       MouseIcon       =   "fMh3dCmd.frx":0A4A
  192.    End
  193.    Begin MhcommdlLib.MhCommonDialog Mhcommdl1 
  194.       Height          =   336
  195.       Left            =   0
  196.       TabIndex        =   4
  197.       Top             =   0
  198.       Width           =   336
  199.       _Version        =   65536
  200.       _ExtentX        =   593
  201.       _ExtentY        =   593
  202.       _StockProps     =   4
  203.       TintColor       =   16711935
  204.       Filename        =   ""
  205.       DialogTop       =   0
  206.       DialogLeft      =   0
  207.       DialogWidth     =   0
  208.       DialogHeight    =   0
  209.       InitDir         =   ""
  210.       Filter          =   ""
  211.       DefaultExt      =   ""
  212.       DialogTitle     =   ""
  213.       FilterIndex     =   0
  214.       Flags           =   0
  215.       CancelError     =   0   'False
  216.       MaxFileSize     =   256
  217.       Color           =   0
  218.       Max             =   0
  219.       Min             =   0
  220.       Copies          =   0
  221.       FromPage        =   0
  222.       PrinterDefault  =   -1  'True
  223.       ToPage          =   0
  224.       HelpCommand     =   0
  225.       HelpContext     =   0
  226.       HelpFile        =   ""
  227.       HelpKey         =   ""
  228.    End
  229.    Begin VB.Label lblXplain 
  230.       Caption         =   "Label1"
  231.       Height          =   1164
  232.       Left            =   120
  233.       TabIndex        =   0
  234.       Top             =   2196
  235.       Width           =   5652
  236.    End
  237.    Begin VB.Menu mnuFile 
  238.       Caption         =   "&File"
  239.       Begin VB.Menu itmExit 
  240.          Caption         =   "E&xit"
  241.       End
  242.    End
  243.    Begin VB.Menu mnuOptions 
  244.       Caption         =   "&Options"
  245.       Begin VB.Menu itmAlignment 
  246.          Caption         =   "&Alignment"
  247.          Begin VB.Menu itmAlign 
  248.             Caption         =   "&Left"
  249.             Index           =   0
  250.          End
  251.          Begin VB.Menu itmAlign 
  252.             Caption         =   "&Right"
  253.             Index           =   1
  254.          End
  255.          Begin VB.Menu itmAlign 
  256.             Caption         =   "&Center"
  257.             Checked         =   -1  'True
  258.             Index           =   2
  259.          End
  260.       End
  261.       Begin VB.Menu itmMultiline 
  262.          Caption         =   "&Multiline Caption"
  263.       End
  264.       Begin VB.Menu itmState 
  265.          Caption         =   "&Use as State Button"
  266.       End
  267.       Begin VB.Menu itmBevelStyle 
  268.          Caption         =   "&Bevel Style"
  269.          Begin VB.Menu itmBevels 
  270.             Caption         =   "&Raised/Lowered"
  271.             Checked         =   -1  'True
  272.             Index           =   0
  273.          End
  274.          Begin VB.Menu itmBevels 
  275.             Caption         =   "&Lowered/Raised"
  276.             Index           =   1
  277.          End
  278.          Begin VB.Menu itmBevels 
  279.             Caption         =   "&Chiseled"
  280.             Index           =   2
  281.          End
  282.       End
  283.       Begin VB.Menu itmBorderStyle 
  284.          Caption         =   "Border &Style"
  285.          Begin VB.Menu itmBorders 
  286.             Caption         =   "&None"
  287.             Index           =   0
  288.          End
  289.          Begin VB.Menu itmBorders 
  290.             Caption         =   "&Single Line"
  291.             Checked         =   -1  'True
  292.             Index           =   1
  293.          End
  294.          Begin VB.Menu itmBorders 
  295.             Caption         =   "Single Line with &Rounded Corners"
  296.             Index           =   2
  297.          End
  298.       End
  299.    End
  300.    Begin VB.Menu mnuColors 
  301.       Caption         =   "&Colors"
  302.       Begin VB.Menu itmColors 
  303.          Caption         =   "&BorderColor"
  304.          Index           =   0
  305.       End
  306.       Begin VB.Menu itmColors 
  307.          Caption         =   "&FillColor"
  308.          Index           =   1
  309.       End
  310.       Begin VB.Menu itmColors 
  311.          Caption         =   "&LightColor"
  312.          Index           =   2
  313.       End
  314.       Begin VB.Menu itmColors 
  315.          Caption         =   "&ShadowColor"
  316.          Index           =   3
  317.       End
  318.       Begin VB.Menu itmColors 
  319.          Caption         =   "&TextColor"
  320.          Index           =   4
  321.       End
  322.    End
  323.    Begin VB.Menu mnuPictures 
  324.       Caption         =   "&Pictures"
  325.       Begin VB.Menu itmPictures 
  326.          Caption         =   "&None"
  327.          Checked         =   -1  'True
  328.          Index           =   0
  329.       End
  330.       Begin VB.Menu itmPictures 
  331.          Caption         =   "&Stretch to fit"
  332.          Index           =   1
  333.       End
  334.       Begin VB.Menu itmPictures 
  335.          Caption         =   "&Original Size"
  336.          Index           =   2
  337.       End
  338.       Begin VB.Menu itmPictures 
  339.          Caption         =   "&Replicate"
  340.          Index           =   3
  341.       End
  342.    End
  343. Attribute VB_Name = "fMh3dCmd"
  344. Attribute VB_Creatable = False
  345. Attribute VB_Exposed = False
  346. Option Explicit
  347. Dim imDown As Integer
  348. Dim imButtonHeight As Integer
  349. Dim imButtonWidth As Integer
  350. Const im_TRUE = -1, im_FALSE = 0
  351. Const im_LEFT = 0, im_TOP = 0, im_RIGHT = 1, im_BOTTOM = 1, im_CENTER = 2
  352. Const im_BORDERCOLOR = 0, im_FILLCOLOR = 1, im_LIGHTCOLOR = 2, im_SHADOWCOLOR = 3, im_TEXTCOLOR = 4
  353. Const im_NONE = 0, im_SINGLE = 1, im_ROUNDED = 2
  354. Const im_LOWERED = 0, im_RAISED = 1, im_CHISELED = 2, im_SHADOWLEFT = 3, im_SHADOWRIGHT = 4
  355. Const im_NOSPIN = 0, im_LEFTSPIN = 1, im_RIGHTSPIN = 2
  356. Const im_RESIZE = 0, im_ATSIZE = 1, im_REPLICATE = 2
  357. Const im_LEAD = 0, im_STATE = 1, im_ALIGN = 2, im_BEVEL = 3, im_BORDER = 4, im_MULTI = 5, im_COLOR = 6, im_PICTURE = 7
  358. Const im_GRAY = &HC0C0C0
  359. Const im_BLACK = &H0&
  360. Const im_DARK_GRAY = &H808080
  361. Const im_WHITE = &HFFFFFF
  362. Const CC_PREVENTFULLOPEN = &H4&
  363. Const CDERR_DIALOGFAILURE = -32768
  364. Sub cmdDecreasePercent_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  365. 'Allows for continuous decrease of the value of example control.
  366. 'Routine checks to make sure button is down, then it sets
  367. 'flag variable so we know when user quits pressing button
  368. 'Then it decreases value until limit reached or user quits
  369. 'Do loop and DoEvents keep things going
  370. 'Flag to quit thrown again in _MouseUp event
  371.     'If user is pressing the mouse button, set flag and do case
  372.     If Button Then
  373.         imDown = im_TRUE
  374.         'if there's already no discernable bevel, quit routine
  375.         If Mh3dCommand1.BevelSize < 0 Then
  376.             Mh3dCommand1.SetFocus
  377.             Exit Sub
  378.         End If
  379.         'Otherwise, reduce the bevel
  380.         While imDown And Mh3dCommand1.BevelSize > 0
  381.             Mh3dCommand1.BevelSize = Mh3dCommand1.BevelSize - 1
  382.             DoEvents
  383.        Wend
  384.     End If
  385. End Sub
  386. Sub cmdDecreasePercent_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  387. 'Sets flag when user quits pressing button
  388.     imDown = im_FALSE
  389. End Sub
  390. Sub cmdIncreasePercent_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  391. 'Allows for continuous increase of the value of example control.
  392. 'Routine checks to make sure button is down, then it sets
  393. 'flag variable so we know when user quits pressing button
  394. 'Then it increases value until limit reached or user quits.
  395. 'The top bevel size is restricted to 5 here for asthetic reasons.
  396. 'It can be larger but it isn't especially good looking.
  397. 'Do loop and DoEvents keep things going
  398. 'Flag to quit thrown again in _MouseUp event
  399.     'If user is pressing the mouse button, set flag and do case
  400.     If Button Then
  401.         imDown = im_TRUE
  402.         'if there's already no discernable bevel, quit routine
  403.         If Mh3dCommand1.BevelSize > 5 Then
  404.             Mh3dCommand1.SetFocus
  405.             Exit Sub
  406.         End If
  407.         'Otherwise, reduce the bevel
  408.         Do
  409.             Mh3dCommand1.BevelSize = Mh3dCommand1.BevelSize + 1
  410.             DoEvents
  411.        Loop While imDown And Mh3dCommand1.BevelSize < 5
  412.     End If
  413. End Sub
  414. Sub cmdIncreasePercent_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  415. 'Sets flag when user quits pressing button
  416.     imDown = im_FALSE
  417. End Sub
  418. Sub Form_Activate()
  419. 'Set focus for statup
  420.     cmdIncreasePercent.SetFocus
  421. End Sub
  422. Sub Form_Load()
  423. 'Because this is an example, we will set all properties
  424. 'through code except those that are explicitly designtime-only
  425. 'properties such as the control name
  426.     'Set properties for the form
  427.     fMh3dCmd.Caption = "MicroHelp Mh3dCommand Example"
  428.     'Set properties for Mh3DCommand1
  429.     'These variables are used for resizing the control if necessary
  430.     imButtonHeight = Mh3dCommand1.Height
  431.     imButtonWidth = Mh3dCommand1.Width
  432.     Mh3dCommand1.Caption = "Single Line Caption"
  433.     'Set properties for frame
  434.     frmStatePicture.BevelSize = 1
  435.     frmStatePicture.Caption = "Press here to see multiple state images"
  436.     'Set properties for Mh3DCommand2
  437.     Mh3dCommand2.BevelSize = 1
  438.     Mh3dCommand2.StateButton = True
  439.     Mh3dCommand2.AutoSize = False
  440.     Mh3dCommand2.WallPaper = im_RESIZE
  441.     Mh3dCommand2.PictureUp = Picture1(0).Picture
  442.     Mh3dCommand2.PicturePressed = Picture1(1).Picture
  443.     Mh3dCommand2.PictureDown = Picture1(2).Picture
  444.     'Set bevel button properties
  445.     cmdDecreasePercent.Alignment = im_CENTER
  446.     cmdDecreasePercent.Caption = "Decrease Bevel"
  447.     cmdIncreasePercent.Alignment = im_CENTER
  448.     cmdIncreasePercent.Caption = "Increase Bevel"
  449.     'Set properties for xplanation label
  450.     lblXplain.WordWrap = True
  451.     lblXplain.Caption = Xplain(im_LEAD)
  452.     ' center form to screen
  453.     Move Abs(Screen.Width - Width) \ 2, Abs(Screen.Height - Height) \ 2
  454. End Sub
  455. Sub itmAlign_Click(Index As Integer)
  456. 'The control's horizontal alignment can be justified
  457. 'left, right and centered.
  458.     Dim iIndex As Integer
  459.     'Turn checks off
  460.     For iIndex = 0 To 2
  461.         itmAlign(iIndex).Checked = False
  462.     Next
  463.     'Make choice and set check
  464.     Select Case Index
  465.         Case im_LEFT
  466.             Mh3dCommand1.Alignment = Index
  467.             itmAlign(Index).Checked = True
  468.         Case im_RIGHT
  469.             Mh3dCommand1.Alignment = Index
  470.             itmAlign(Index).Checked = True
  471.         Case im_CENTER
  472.             Mh3dCommand1.Alignment = Index
  473.             itmAlign(Index).Checked = True
  474.     End Select
  475.     lblXplain.Caption = Xplain(im_ALIGN)
  476. End Sub
  477. Sub itmBevels_Click(Index As Integer)
  478. 'Routine picks bevel style for control. There's no raised
  479. 'option here because raised and lowered are automatically
  480. 'part of the lowered setting in a toggle button such as
  481. 'this one.
  482.     Dim iIndex As Integer
  483.     'if Bevelsize = 0, there's nothing else to set
  484.     'so we tell the user and then exit
  485.     If Mh3dCommand1.BevelSize = 0 Then
  486.         MsgBox "You must set .BevelSize to something other than zero for this property to have any effect.", 16, "MicroHelp"
  487.         Exit Sub
  488.     End If
  489.     'Turn all the checks off
  490.     For iIndex = 0 To 2
  491.         itmBevels(iIndex).Checked = False
  492.     Next
  493.     'Change style and check appropriate menu item
  494.     Select Case Index
  495.         Case im_LOWERED
  496.             Mh3dCommand1.BevelStyle = Index
  497.             itmBevels(Index).Checked = True
  498.         Case im_RAISED
  499.             Mh3dCommand1.BevelStyle = Index
  500.             itmBevels(Index).Checked = True
  501.         Case im_CHISELED
  502.             Mh3dCommand1.BevelStyle = Index
  503.             itmBevels(Index).Checked = True
  504.         Case im_SHADOWLEFT
  505.             Mh3dCommand1.BevelStyle = Index
  506.             itmBevels(Index).Checked = True
  507.         Case im_SHADOWRIGHT
  508.             Mh3dCommand1.BevelStyle = Index
  509.             itmBevels(Index).Checked = True
  510.     End Select
  511.     lblXplain.Caption = Xplain(im_BEVEL)
  512. End Sub
  513. Sub itmBorders_Click(Index As Integer)
  514. 'Sets border size for control
  515.     Dim iIndex As Integer
  516.     'Turn checks off
  517.     For iIndex = 0 To 2
  518.         itmBorders(iIndex).Checked = False
  519.     Next
  520.     'Makes selection and set appropriate check
  521.     Select Case Index
  522.         Case im_NONE
  523.             Mh3dCommand1.BorderStyle = Index
  524.             itmBorders(Index).Checked = True
  525.         Case im_SINGLE
  526.             Mh3dCommand1.BorderStyle = Index
  527.             itmBorders(Index).Checked = True
  528.         Case im_ROUNDED
  529.             Mh3dCommand1.BorderStyle = Index
  530.             itmBorders(Index).Checked = True
  531.     End Select
  532.     lblXplain.Caption = Xplain(im_BORDER)
  533. End Sub
  534. Sub itmColors_Click(Index As Integer)
  535. 'Routine calls up common color dialog so we can
  536. 'illustrate the color properties of the control.
  537. 'Note that we don't set .ForeColor or .BackColor
  538. 'even though they appear in the properties list.
  539. 'Changing them can cause bizarre color display and
  540. 'some controls may behave strangely. Leave those
  541. 'properties at their defaults
  542.     If Index = 0 And Mh3dCommand1.BorderStyle = im_NONE Then
  543.         MsgBox "You must set Border Style to something other than none for this property to have any effect.", 16, "MicroHelp"
  544.         Exit Sub
  545.     End If
  546.     'Sets flag to prevent custom color palette from
  547.     'appearing, calls dialog and sets appropriate
  548.     'color property when dialog closes.
  549.     Mhcommdl1.Flags = CC_PREVENTFULLOPEN
  550.     Mhcommdl1.CancelError = True
  551.     On Error GoTo ColorError
  552.     Mhcommdl1.Action = 3
  553.     Select Case Index
  554.         Case im_BORDERCOLOR
  555.             Mh3dCommand1.BorderColor = Mhcommdl1.Color
  556.         Case im_FILLCOLOR
  557.             Mh3dCommand1.FillColor = Mhcommdl1.Color
  558.         Case im_LIGHTCOLOR
  559.             Mh3dCommand1.LightColor = Mhcommdl1.Color
  560.         Case im_SHADOWCOLOR
  561.             Mh3dCommand1.ShadowColor = Mhcommdl1.Color
  562.         Case im_TEXTCOLOR
  563.             Mh3dCommand1.TextColor = Mhcommdl1.Color
  564.     End Select
  565.     lblXplain.Caption = Xplain(im_COLOR)
  566. Exit Sub
  567. ColorError:
  568.     Select Case Index
  569.         Case im_BORDERCOLOR
  570.             Mh3dCommand1.BorderColor = Mh3dCommand1.BorderColor
  571.         Case im_FILLCOLOR
  572.             Mh3dCommand1.FillColor = Mh3dCommand1.FillColor
  573.         Case im_LIGHTCOLOR
  574.             Mh3dCommand1.LightColor = Mh3dCommand1.LightColor
  575.         Case im_SHADOWCOLOR
  576.             Mh3dCommand1.ShadowColor = Mh3dCommand1.ShadowColor
  577.         Case im_TEXTCOLOR
  578.             Mh3dCommand1.TextColor = Mh3dCommand1.TextColor
  579.     End Select
  580. Exit Sub
  581. End Sub
  582. Sub itmExit_Click()
  583. 'Unload form and quit
  584.     Unload fMh3dCmd
  585.     End
  586. End Sub
  587. Sub itmMultiline_Click()
  588. 'Set multiline function of control
  589.     If Mh3dCommand1.MultiLine = False Then
  590.         Mh3dCommand1.MultiLine = True
  591.         Mh3dCommand1.Caption = "This rather verbose piece of text is an example of a multiline caption for the MicroHelp Mh3dCommand button custom control"
  592.         itmMultiline.Caption = "Single Line Caption"
  593.     Else
  594.         Mh3dCommand1.MultiLine = False
  595.         Mh3dCommand1.Caption = "Single line caption"
  596.         itmMultiline.Caption = "Multiline Caption"
  597.     End If
  598.     lblXplain.Caption = Xplain(im_MULTI)
  599. End Sub
  600. Private Sub itmPictures_Click(Index As Integer)
  601. 'This routine places a picture in the frame area.
  602.     Dim iIndex As Integer
  603.     'Turn checks off
  604.     For iIndex = 0 To 3
  605.         itmPictures(iIndex).Checked = False
  606.     Next
  607.     'Place picture and check menu item
  608.     Select Case Index
  609.         Case 0
  610.             'If they don't want a picture in the control
  611.             Mh3dCommand1.Picture = LoadPicture("")
  612.             SetButtonSize
  613.             itmPictures(Index).Checked = True
  614.         Case 1
  615.             Mh3dCommand1.AutoSize = False
  616.             Mh3dCommand1.WallPaper = im_RESIZE
  617.             Mh3dCommand1.Picture = Picture1(1).Picture
  618.             itmPictures(Index).Checked = True
  619.         Case 2
  620.             Mh3dCommand1.AutoSize = False
  621.             Mh3dCommand1.WallPaper = im_ATSIZE
  622.             Mh3dCommand1.Picture = Picture1(1).Picture
  623.             SetButtonSize
  624.             itmPictures(Index).Checked = True
  625.         Case 3
  626.             SetButtonSize
  627.             Mh3dCommand1.Picture = Picture1(1).Picture
  628.             Mh3dCommand1.WallPaper = im_REPLICATE
  629.             itmPictures(Index).Checked = True
  630.     End Select
  631.     lblXplain.Caption = Xplain(im_PICTURE)
  632. End Sub
  633. Sub itmState_Click()
  634. 'The control can be used as a state button,
  635. 'meaning it can remain in the depressed position
  636. 'to indicate that it has been pressed and the
  637. 'routine is executing. The state can be
  638. 'programmatically reset at the end of the routine
  639.     If Mh3dCommand1.StateButton = False Then
  640.         Mh3dCommand1.StateButton = True
  641.         itmState.Caption = "Use As Non-State Button"
  642.     Else
  643.         Mh3dCommand1.StateButton = False
  644.         itmState.Caption = "Use As State Button"
  645.     End If
  646.     lblXplain.Caption = Xplain(im_STATE)
  647. End Sub
  648. Sub SetButtonSize()
  649. 'Resizes the button to it's original startup size
  650.             
  651.             Mh3dCommand1.Height = imButtonHeight
  652.             Mh3dCommand1.Width = imButtonWidth
  653. End Sub
  654. Function Xplain(Index As Integer) As String
  655.     Select Case Index
  656.         Case im_LEAD
  657.             Xplain = "MicroHelp's Mh3dCommand Button is an enhanced command button that allows you to display pictures, control the 3-D appearance of the button, determine all the colors used on the control, provide multiline-captions, provide a " & Chr$(34) & "state" & Chr$(34) & " condition that determines whether the button appears up or down and display different bitmaps for each of those states."
  658.         Case im_STATE
  659.             Xplain = "Mh3dCommand Button has the capacity to be a state button, meaning it can remain in the down position until the user either clicks on it again or the programmer changes the boolean .Value property to reset the control. The button at the bottom of the form is always a state button. The button at the top can be made a state button by clicking Options/Use As State Button"
  660.         Case im_ALIGN
  661.             Xplain = "The text on a Mh3dCommand Button can be justified to the left, right or centered in the control and this alignment property can be set at runtime if need be."
  662.         Case im_BEVEL
  663.             Xplain = "The bevel of the control -- a combination of dark and light areas at the edge of the control -- can be set. While you have full control over the colors of these bevel areas, a combination of black, dark gray and white provides the three-dimensional look most programmers want. While the bevelsize in this demo tops out at 5, you could dramatically increase the bevel for an unusual look."
  664.         Case im_BORDER
  665.             Xplain = "The Mh3dCommand button can be used with no border, with a border with squared corners or the default Windows standard of a border with rounded corners. The programmer can control the color of the border."
  666.         Case im_MULTI
  667.             Xplain = "The Mh3dCommand button can display single-line captions, just like the Visual Basic command button. But in addition, it can display text on multiple lines, centered or justified left or right."
  668.         Case im_COLOR
  669.             Xplain = "Programmers have complete control over the colors used in the button. The control's text, fill area, border and bevels can all be set to custom colors to match the needs of your application."
  670.         Case im_PICTURE
  671.             Xplain = "Mh3dCommand buttons can display pictures at original size, stretched to the size of the control or replicated to fill the control. A single picture can be used or multiple pictures can be used for the button up, down and pressed states. Press the bottom button for an example of that in action."
  672.     End Select
  673. End Function
  674.