home *** CD-ROM | disk | FTP | other *** search
/ ActiveX Programming Unleashed CD / AXU.iso / activex / demos / oletrial / samples / vb / mhtip / mhtip_a.frm (.txt) next >
Encoding:
Visual Basic Form  |  1995-11-02  |  21.4 KB  |  620 lines

  1. VERSION 4.00
  2. Begin VB.Form fMain 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "MicroHelp VBTools 5 - MhTip Example"
  5.    ClientHeight    =   4092
  6.    ClientLeft      =   1056
  7.    ClientTop       =   2892
  8.    ClientWidth     =   8220
  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          =   4560
  20.    Left            =   996
  21.    LinkTopic       =   "Form1"
  22.    ScaleHeight     =   4092
  23.    ScaleWidth      =   8220
  24.    Top             =   2484
  25.    Width           =   8340
  26.    Begin VB.CommandButton cmdAction 
  27.       Appearance      =   0  'Flat
  28.       BackColor       =   &H80000005&
  29.       Caption         =   "E&xit"
  30.       Height          =   510
  31.       Index           =   1
  32.       Left            =   6255
  33.       TabIndex        =   18
  34.       Top             =   3015
  35.       Width           =   1815
  36.    End
  37.    Begin VB.ComboBox cboTipConfig 
  38.       BeginProperty Font 
  39.          name            =   "MS Sans Serif"
  40.          charset         =   0
  41.          weight          =   400
  42.          size            =   7.8
  43.          underline       =   0   'False
  44.          italic          =   0   'False
  45.          strikethrough   =   0   'False
  46.       EndProperty
  47.       Height          =   315
  48.       Left            =   1845
  49.       Style           =   2  'Dropdown List
  50.       TabIndex        =   14
  51.       Top             =   270
  52.       Width           =   2940
  53.    End
  54.    Begin VB.CommandButton cmdAction 
  55.       Appearance      =   0  'Flat
  56.       BackColor       =   &H80000005&
  57.       Caption         =   "&View Properties..."
  58.       Height          =   510
  59.       Index           =   0
  60.       Left            =   6255
  61.       TabIndex        =   16
  62.       Top             =   2430
  63.       Width           =   1815
  64.    End
  65.    Begin VB.Frame fraSettings 
  66.       Caption         =   "Style"
  67.       BeginProperty Font 
  68.          name            =   "MS Sans Serif"
  69.          charset         =   0
  70.          weight          =   400
  71.          size            =   7.8
  72.          underline       =   0   'False
  73.          italic          =   0   'False
  74.          strikethrough   =   0   'False
  75.       EndProperty
  76.       Height          =   1230
  77.       Index           =   2
  78.       Left            =   2835
  79.       TabIndex        =   11
  80.       Top             =   2295
  81.       Width           =   1950
  82.       Begin VB.OptionButton optStyle 
  83.          Caption         =   "Balloon tip."
  84.          BeginProperty Font 
  85.             name            =   "MS Sans Serif"
  86.             charset         =   0
  87.             weight          =   400
  88.             size            =   7.8
  89.             underline       =   0   'False
  90.             italic          =   0   'False
  91.             strikethrough   =   0   'False
  92.          EndProperty
  93.          Height          =   240
  94.          Index           =   1
  95.          Left            =   225
  96.          TabIndex        =   13
  97.          Top             =   630
  98.          Width           =   1275
  99.       End
  100.       Begin VB.OptionButton optStyle 
  101.          Caption         =   "Square tip."
  102.          BeginProperty Font 
  103.             name            =   "MS Sans Serif"
  104.             charset         =   0
  105.             weight          =   400
  106.             size            =   7.8
  107.             underline       =   0   'False
  108.             italic          =   0   'False
  109.             strikethrough   =   0   'False
  110.          EndProperty
  111.          Height          =   240
  112.          Index           =   0
  113.          Left            =   225
  114.          TabIndex        =   12
  115.          Top             =   360
  116.          Value           =   -1  'True
  117.          Width           =   1275
  118.       End
  119.    End
  120.    Begin VB.Frame fraSettings 
  121.       Caption         =   "AutoSizing Features"
  122.       BeginProperty Font 
  123.          name            =   "MS Sans Serif"
  124.          charset         =   0
  125.          weight          =   400
  126.          size            =   7.8
  127.          underline       =   0   'False
  128.          italic          =   0   'False
  129.          strikethrough   =   0   'False
  130.       EndProperty
  131.       Height          =   1230
  132.       Index           =   1
  133.       Left            =   135
  134.       TabIndex        =   7
  135.       Top             =   2295
  136.       Width           =   2535
  137.       Begin VB.OptionButton optAutoSize 
  138.          Caption         =   "No AutoSize."
  139.          BeginProperty Font 
  140.             name            =   "MS Sans Serif"
  141.             charset         =   0
  142.             weight          =   400
  143.             size            =   7.8
  144.             underline       =   0   'False
  145.             italic          =   0   'False
  146.             strikethrough   =   0   'False
  147.          EndProperty
  148.          Height          =   240
  149.          Index           =   0
  150.          Left            =   225
  151.          TabIndex        =   10
  152.          Top             =   315
  153.          Value           =   -1  'True
  154.          Width           =   1455
  155.       End
  156.       Begin VB.OptionButton optAutoSize 
  157.          Caption         =   "AutoSize to Text."
  158.          BeginProperty Font 
  159.             name            =   "MS Sans Serif"
  160.             charset         =   0
  161.             weight          =   400
  162.             size            =   7.8
  163.             underline       =   0   'False
  164.             italic          =   0   'False
  165.             strikethrough   =   0   'False
  166.          EndProperty
  167.          Height          =   240
  168.          Index           =   1
  169.          Left            =   225
  170.          TabIndex        =   9
  171.          Top             =   585
  172.          Width           =   1770
  173.       End
  174.       Begin VB.OptionButton optAutoSize 
  175.          Caption         =   "AutoSize to Picture."
  176.          BeginProperty Font 
  177.             name            =   "MS Sans Serif"
  178.             charset         =   0
  179.             weight          =   400
  180.             size            =   7.8
  181.             underline       =   0   'False
  182.             italic          =   0   'False
  183.             strikethrough   =   0   'False
  184.          EndProperty
  185.          Height          =   240
  186.          Index           =   2
  187.          Left            =   225
  188.          TabIndex        =   8
  189.          Top             =   855
  190.          Width           =   1995
  191.       End
  192.    End
  193.    Begin VB.PictureBox picTipPicture 
  194.       Appearance      =   0  'Flat
  195.       AutoSize        =   -1  'True
  196.       BackColor       =   &H80000005&
  197.       ForeColor       =   &H80000008&
  198.       Height          =   1332
  199.       Left            =   4995
  200.       Picture         =   "mhtip_a.frx":0000
  201.       ScaleHeight     =   1308
  202.       ScaleWidth      =   996
  203.       TabIndex        =   4
  204.       Top             =   1935
  205.       Visible         =   0   'False
  206.       Width           =   1020
  207.    End
  208.    Begin VB.PictureBox picStatusBar 
  209.       Align           =   2  'Align Bottom
  210.       Appearance      =   0  'Flat
  211.       BackColor       =   &H80000005&
  212.       ForeColor       =   &H80000008&
  213.       Height          =   420
  214.       Left            =   0
  215.       ScaleHeight     =   396
  216.       ScaleWidth      =   8196
  217.       TabIndex        =   2
  218.       Top             =   3675
  219.       Width           =   8220
  220.       Begin VB.Label lblComment 
  221.          Appearance      =   0  'Flat
  222.          BackColor       =   &H00C0C0C0&
  223.          BeginProperty Font 
  224.             name            =   "Arial"
  225.             charset         =   0
  226.             weight          =   400
  227.             size            =   8.4
  228.             underline       =   0   'False
  229.             italic          =   0   'False
  230.             strikethrough   =   0   'False
  231.          EndProperty
  232.          ForeColor       =   &H80000008&
  233.          Height          =   240
  234.          Left            =   135
  235.          TabIndex        =   3
  236.          Top             =   90
  237.          Width           =   1950
  238.       End
  239.    End
  240.    Begin VB.Frame fraSettings 
  241.       Caption         =   "Display Settings"
  242.       BeginProperty Font 
  243.          name            =   "MS Sans Serif"
  244.          charset         =   0
  245.          weight          =   400
  246.          size            =   7.8
  247.          underline       =   0   'False
  248.          italic          =   0   'False
  249.          strikethrough   =   0   'False
  250.       EndProperty
  251.       Height          =   1410
  252.       Index           =   0
  253.       Left            =   135
  254.       TabIndex        =   0
  255.       Top             =   765
  256.       Width           =   4650
  257.       Begin VB.CheckBox chkMultiLine 
  258.          Caption         =   "Set the .MultiLine property."
  259.          BeginProperty Font 
  260.             name            =   "MS Sans Serif"
  261.             charset         =   0
  262.             weight          =   400
  263.             size            =   7.8
  264.             underline       =   0   'False
  265.             italic          =   0   'False
  266.             strikethrough   =   0   'False
  267.          EndProperty
  268.          Height          =   240
  269.          Left            =   270
  270.          TabIndex        =   6
  271.          Top             =   945
  272.          Width           =   2625
  273.       End
  274.       Begin VB.CheckBox chkStatusBar 
  275.          Caption         =   "Display tip captions in the status bar."
  276.          BeginProperty Font 
  277.             name            =   "MS Sans Serif"
  278.             charset         =   0
  279.             weight          =   400
  280.             size            =   7.8
  281.             underline       =   0   'False
  282.             italic          =   0   'False
  283.             strikethrough   =   0   'False
  284.          EndProperty
  285.          Height          =   240
  286.          Left            =   270
  287.          TabIndex        =   5
  288.          Top             =   675
  289.          Width           =   3480
  290.       End
  291.       Begin VB.CheckBox chkTipChildren 
  292.          Caption         =   "Set the .TipChildren property."
  293.          BeginProperty Font 
  294.             name            =   "MS Sans Serif"
  295.             charset         =   0
  296.             weight          =   400
  297.             size            =   7.8
  298.             underline       =   0   'False
  299.             italic          =   0   'False
  300.             strikethrough   =   0   'False
  301.          EndProperty
  302.          Height          =   240
  303.          Left            =   270
  304.          TabIndex        =   1
  305.          Top             =   405
  306.          Width           =   2805
  307.       End
  308.    End
  309.    Begin MhtipLib.MhTip MhTip1 
  310.       Height          =   264
  311.       Left            =   4992
  312.       TabIndex        =   19
  313.       Top             =   1668
  314.       Width           =   732
  315.       _Version        =   65536
  316.       _ExtentX        =   1291
  317.       _ExtentY        =   466
  318.       _StockProps     =   79
  319.       Caption         =   "MhTip1"
  320.       BevelStyle      =   1
  321.       BevelStyleInner =   0
  322.       BevelSize       =   1
  323.       BorderColor     =   -2147483642
  324.       FillColor       =   -2147483624
  325.       LightColor      =   -2147483628
  326.       Multiline       =   0   'False
  327.       NoPrefix        =   -1  'True
  328.       ShadowColor     =   -2147483632
  329.       TextColor       =   -2147483625
  330.       VAlignment      =   0
  331.       WallPaper       =   0
  332.       Picture         =   "mhtip_a.frx":133E
  333.       Alignment       =   0
  334.       FontTransparent =   -1  'True
  335.       BevelSizeInner  =   0
  336.       FontStyle       =   0
  337.       AutoSize        =   -1  'True
  338.       Interval        =   1000
  339.       TipOffsetTop    =   10
  340.       TipOffsetLeft   =   10
  341.       AutosizeToText  =   -1  'True
  342.       BorderStyle     =   1
  343.       TipStyle        =   0
  344.       TipChildren     =   0   'False
  345.       NoTipCapture    =   0   'False
  346.    End
  347.    Begin VB.Label Label1 
  348.       Caption         =   $"mhtip_a.frx":135A
  349.       BeginProperty Font 
  350.          name            =   "MS Sans Serif"
  351.          charset         =   0
  352.          weight          =   400
  353.          size            =   7.8
  354.          underline       =   0   'False
  355.          italic          =   0   'False
  356.          strikethrough   =   0   'False
  357.       EndProperty
  358.       Height          =   1410
  359.       Left            =   4995
  360.       TabIndex        =   15
  361.       Top             =   180
  362.       Width           =   3075
  363.    End
  364.    Begin VB.Label lblTipConfig 
  365.       Caption         =   "Tip Configuration:"
  366.       BeginProperty Font 
  367.          name            =   "MS Sans Serif"
  368.          charset         =   0
  369.          weight          =   400
  370.          size            =   7.8
  371.          underline       =   0   'False
  372.          italic          =   0   'False
  373.          strikethrough   =   0   'False
  374.       EndProperty
  375.       Height          =   240
  376.       Left            =   180
  377.       TabIndex        =   17
  378.       Top             =   315
  379.       Width           =   1590
  380.    End
  381. Attribute VB_Name = "fMain"
  382. Attribute VB_Creatable = False
  383. Attribute VB_Exposed = False
  384. Option Explicit
  385. Dim sComments(0 To 10) As String
  386. ' Create a 3-D effect either pushing in
  387. ' or out.
  388. Private Sub Border1(Picture As Control, Direction As String, Depth As Integer)
  389. Dim lTopLeft As Long
  390. Dim lBottomRight As Long
  391. Dim iWidth As Integer
  392.     If UCase$(Direction) = "IN" Then
  393.         lTopLeft = RGB(128, 128, 128)
  394.         lBottomRight = RGB(255, 255, 255)
  395.     End If
  396.     If UCase$(Direction) = "OUT" Then
  397.         lTopLeft = RGB(255, 255, 255)
  398.         lBottomRight = RGB(128, 128, 128)
  399.     End If
  400.     Picture.ScaleMode = 3
  401.     Picture.DrawWidth = 1
  402.     Picture.BackColor = &HC0C0C0
  403.     For iWidth = 0 To Depth - 1
  404.         Picture.Line (iWidth, iWidth)-(iWidth, Picture.ScaleHeight - iWidth), lTopLeft
  405.         Picture.Line (iWidth, iWidth)-(Picture.ScaleWidth - iWidth, iWidth), lTopLeft
  406.         Picture.Line (Picture.ScaleWidth - iWidth - 1, iWidth + 1)-(Picture.ScaleWidth - iWidth - 1, Picture.ScaleHeight - iWidth), lBottomRight
  407.         Picture.Line (iWidth + 1, Picture.ScaleHeight - iWidth - 1)-(Picture.ScaleWidth - iWidth, Picture.ScaleHeight - iWidth - 1), lBottomRight
  408.     Next
  409.     Picture.ScaleMode = 1
  410. End Sub
  411. Private Sub cboTipConfig_Change()
  412.     ' Set specific properties of the MhTip.
  413.     Select Case cboTipConfig.Text
  414.         Case "(None)"
  415.             ' Display Settings.
  416.             chkTipChildren.Value = 0
  417.             chkStatusBar.Value = 0
  418.             chkMultiLine.Value = 0
  419.             ' Autosize features.
  420.             optAutoSize(0).Value = True
  421.             ' Style.
  422.             optStyle(0).Value = True
  423.         Case "Simple Tips"
  424.             ' Display Settings.
  425.             chkTipChildren.Value = 1
  426.             chkStatusBar.Value = 0
  427.             chkMultiLine.Value = 0
  428.             ' Autosize features.
  429.             optAutoSize(1).Value = True
  430.             ' Style.
  431.             optStyle(0).Value = True
  432.         Case "Legal Pad"
  433.             ' Display Settings.
  434.             chkTipChildren.Value = 1
  435.             chkStatusBar.Value = 0
  436.             chkMultiLine.Value = 1
  437.             ' Autosize features.
  438.             optAutoSize(2).Value = True
  439.             ' Style.
  440.             optStyle(0).Value = True
  441.         Case "Word-Balloon"
  442.             ' Display Settings.
  443.             chkTipChildren.Value = 1
  444.             chkStatusBar.Value = 0
  445.             chkMultiLine.Value = 1
  446.             ' Autosize features.
  447.             optAutoSize(1).Value = True
  448.             ' Style.
  449.             optStyle(1).Value = True
  450.         Case "Status Bar"
  451.             ' Display Settings.
  452.             chkTipChildren.Value = 1
  453.             chkStatusBar.Value = 1
  454.             chkMultiLine.Value = 0
  455.             ' Autosize features.
  456.             optAutoSize(0).Value = True
  457.             ' Style.
  458.             optStyle(0).Value = True
  459.     End Select
  460. End Sub
  461. Private Sub cboTipConfig_Click()
  462.     cboTipConfig_Change
  463. End Sub
  464. Private Sub chkMultiLine_Click()
  465.     ' Toggle whether the MhTip control
  466.     ' will display text on multiple lines.
  467.     MhTip1.MultiLine = Not MhTip1.MultiLine
  468. End Sub
  469. Private Sub chkTipChildren_Click()
  470.     ' Toggle whether the MhTip control
  471.     ' fires over child controls within containers.
  472.     MhTip1.TipChildren = Not MhTip1.TipChildren
  473. End Sub
  474. Private Sub cmdAction_Click(Index As Integer)
  475.     Select Case Index
  476.         ' View properties.
  477.         Case 0
  478.             fProperties.Show 1
  479.         ' Exit.
  480.         Case 1
  481.             Unload fMain
  482.     End Select
  483. End Sub
  484. Private Sub Form_Load()
  485.     ' Load configuration settings.
  486.     ' These are different groups of property settings
  487.     ' that give the MhTip control unique looks.
  488.     cboTipConfig.AddItem "(None)"
  489.     cboTipConfig.AddItem "Simple Tips"
  490.     cboTipConfig.AddItem "Legal Pad"
  491.     cboTipConfig.AddItem "Word-Balloon"
  492.     cboTipConfig.AddItem "Status Bar"
  493.     cboTipConfig.ListIndex = 0
  494.     ' center form to screen
  495.     Move Abs(Screen.Width - Width) \ 2, Abs(Screen.Height - Height) \ 2
  496. End Sub
  497. Private Sub lblComment_Change()
  498.     lblComment.Width = picStatusBar.TextWidth(lblComment.Caption)
  499. End Sub
  500. ' This event is fired when the mouse pointer
  501. ' leaves a control and the MhTip control disappears.
  502. Private Sub MhTip1_HideTip()
  503.     Debug.Print "_HideTip event fired"
  504. End Sub
  505. ' This event is fired every time the mouse pointer
  506. ' moves over a control.
  507. Private Sub MhTip1_SetCaption(ControlName As String, hWnd As Integer, MakeVisible As Integer, MouseX As Integer, MouseY As Integer)
  508. Dim sTipCaption As String
  509. Dim iShowInStatus As Integer
  510.     Debug.Print "_SetCaption event fired"
  511.     iShowInStatus = chkStatusBar.Value
  512.     ' Setting the parameter MakeVisible to False
  513.     ' will stop the MhTip control from displaying.
  514.     ' You can then display the desired caption elsewhere.
  515.     If iShowInStatus Then MakeVisible = False
  516.     ' Set caption string.
  517.     sTipCaption = ""
  518.     Select Case ControlName
  519.         ' Frames (groups).
  520.         Case "fraSettings(0)"
  521.             sTipCaption = "Group - Set up when the MhTip control will display."
  522.         Case "fraSettings(1)"
  523.             sTipCaption = "Group - Set up how the MhTip control will resize to its contents."
  524.         Case "fraSettings(2)"
  525.             sTipCaption = "Group - Set up what the MhTip control will look like."
  526.         ' Configuration.
  527.         Case "cboTipConfig"
  528.             sTipCaption = "Set groups of properties to give the MhTip a unique look."
  529.         ' Display Settings.
  530.         Case "chkTipChildren"
  531.             sTipCaption = "Check to allow MhTip to fire over child controls."
  532.         Case "chkStatusBar"
  533.             sTipCaption = "Check to turn off the MhTip and display tip captions in the status bar."
  534.         Case "chkMultiLine"
  535.             sTipCaption = "Check to word-wrap the contents of the MhTip control across several lines."
  536.         ' Autosize features.
  537.         Case "optAutoSize(0)"
  538.             sTipCaption = "Do not resize the MhTip control."
  539.         Case "optAutoSize(1)"
  540.             sTipCaption = "Resize the MhTip control to the size of the text in the .Caption property."
  541.         Case "optAutoSize(2)"
  542.             sTipCaption = "Resize the MhTip control to the size of the picture in the .Picture property."
  543.         ' Style.
  544.         Case "optStyle(0)"
  545.             sTipCaption = "Display a square tip."
  546.         Case "optStyle(1)"
  547.             sTipCaption = "Display a tip in the shape of a word-balloon."
  548.         ' Buttons.
  549.         Case "cmdAction(0)"
  550.             sTipCaption = "View the important property settings for the current MhTip."
  551.         Case "cmdAction(1)"
  552.             sTipCaption = "Exit this example application."
  553.         ' Don't display if there is no tip.
  554.         Case Else
  555.             sTipCaption = "Ready."
  556.             MakeVisible = False
  557.     End Select
  558.     ' Display caption in appropriate control:
  559.     ' either the MhTip or the status bar (lblComment).
  560.     If iShowInStatus Then
  561.         lblComment.Caption = sTipCaption
  562.     Else
  563.         MhTip1.Caption = sTipCaption
  564.         lblComment.Caption = "Ready."
  565.     End If
  566. End Sub
  567. Private Sub optAutoSize_Click(Index As Integer)
  568.     ' Many diplay properties (such as .BorderStyle and .FontBold)
  569.     ' are set to accommodate the changes in alignment.
  570.     Select Case Index
  571.         ' No AutoSize.
  572.         Case 0
  573.             ' Autosize.
  574.             MhTip1.AutoSize = False
  575.             MhTip1.AutosizeToText = False
  576.             ' Alignment.
  577.             MhTip1.Alignment = 1
  578.             MhTip1.VAlignment = 1
  579.             ' Image.
  580.             MhTip1.Picture = LoadPicture("")
  581.             MhTip1.BorderStyle = 1
  582.             MhTip1.FontBold = False
  583.         ' AutoSize to Text.
  584.         Case 1
  585.             ' Autosize.
  586.             MhTip1.AutoSize = False
  587.             MhTip1.AutosizeToText = True
  588.             ' Alignment.
  589.             MhTip1.Alignment = 1
  590.             MhTip1.VAlignment = 1
  591.             ' Image.
  592.             MhTip1.Picture = LoadPicture("")
  593.             MhTip1.BorderStyle = 2
  594.             MhTip1.FontBold = False
  595.         ' AutoSize to Picture.
  596.         Case 2
  597.             ' Autosize.
  598.             MhTip1.AutoSize = True
  599.             MhTip1.AutosizeToText = False
  600.             ' Alignment.
  601.             MhTip1.Alignment = 2
  602.             MhTip1.VAlignment = 2
  603.             ' Image.
  604.             MhTip1.Picture = picTipPicture.Picture
  605.             MhTip1.BorderStyle = 0
  606.             MhTip1.FontBold = True
  607.     End Select
  608. End Sub
  609. Private Sub optStyle_Click(Index As Integer)
  610.     ' Specify whether the MhTip control appears
  611.     ' as a box or a word ballon.
  612.     MhTip1.TipStyle = Index
  613. End Sub
  614. Private Sub picStatusBar_Paint()
  615.     Border1 picStatusBar, "OUT", 1
  616. End Sub
  617. Private Sub ViewProperties()
  618.             
  619. End Sub
  620.