home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD142681292001.psc / Form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-01-26  |  4.0 KB  |  97 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    AutoRedraw      =   -1  'True
  4.    Caption         =   "Form1"
  5.    ClientHeight    =   3705
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   4680
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   3705
  11.    ScaleWidth      =   4680
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin VB.OptionButton Option1 
  14.       Caption         =   "With Columns"
  15.       Height          =   285
  16.       Index           =   1
  17.       Left            =   375
  18.       TabIndex        =   1
  19.       Top             =   2790
  20.       Width           =   1740
  21.    End
  22.    Begin VB.OptionButton Option1 
  23.       Caption         =   "Default"
  24.       Height          =   285
  25.       Index           =   0
  26.       Left            =   390
  27.       TabIndex        =   0
  28.       Top             =   2460
  29.       Value           =   -1  'True
  30.       Width           =   1740
  31.    End
  32.    Begin VB.Label Label2 
  33.       Caption         =   "laudeci@quality-al.com.br"
  34.       Height          =   165
  35.       Left            =   1500
  36.       TabIndex        =   3
  37.       Top             =   3465
  38.       Width           =   3045
  39.    End
  40.    Begin VB.Label Label1 
  41.       AutoSize        =   -1  'True
  42.       Caption         =   "Right Click  anywhere in this form to get your Dynamic Menu"
  43.       Height          =   195
  44.       Left            =   150
  45.       TabIndex        =   2
  46.       Top             =   150
  47.       Width           =   4245
  48.    End
  49. Attribute VB_Name = "Form1"
  50. Attribute VB_GlobalNameSpace = False
  51. Attribute VB_Creatable = False
  52. Attribute VB_PredeclaredId = True
  53. Attribute VB_Exposed = False
  54. Option Explicit
  55. Dim mMenu As cVBPopUpMenu
  56. Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  57. If Button = vbRightButton Then
  58.         Dim mResult As Long
  59.         Set mMenu = New cVBPopUpMenu
  60.         mMenu.CreateMenuPopUp
  61.         With mMenu
  62.             If Option1(0).Value Then
  63.                 .AddMenu "Teste1", MFT_STRING, MFS_ENABLED, 100
  64.                 .AddMenu "Teste2", MFT_STRING, MFS_ENABLED + MFS_DEFAULT, 200
  65.                 .AddMenu "dgjsdjg ", MFT_STRING, MFS_ENABLED, 350
  66.                 .AddMenu "Teste3", MFT_STRING, MFS_ENABLED, 400
  67.                 .CreateSubMenu "Sub Test1", MFT_STRING, MFS_ENABLED, 401
  68.                 .SubMenu.Add "Item 1", MFT_STRING, MFS_ENABLED + MFS_HILITE, 402
  69.                 .SubMenu.Add "/Separator/", MFT_SEPARATOR, MFS_ENABLED, 403
  70.                 .SubMenu.Add "Item 2", MFT_STRING, MFS_ENABLED + MFS_CHECKED, 404
  71.                 .CreateSubMenu "Sub Test2", MFT_STRING, MFS_ENABLED, 405
  72.                 .SubMenu.Add "Item 1", MFT_STRING, MFS_ENABLED + MFS_ENABLED, 406
  73.                 .SubMenu.Add "/Separator/", MFT_SEPARATOR, MFS_ENABLED, 407
  74.                 .SubMenu.Add "Item 2", MFT_STRING, MFS_ENABLED + MFS_DEFAULT, 408
  75.             
  76.             Else
  77.                 .AddMenu "Teste1", MFT_STRING, MFS_ENABLED, 100
  78.                 .AddMenu "Teste2", MFT_STRING, MFS_ENABLED + MFS_DEFAULT, 200
  79.                 .AddMenu "dgjsdjg ", MFT_STRING + MFT_MENUBARBREAK, MFS_ENABLED, 350
  80.                 .AddMenu "Teste3", MFT_STRING, MFS_ENABLED, 400
  81.                 .CreateSubMenu "Sub Test1", MFT_STRING + MFT_MENUBARBREAK, MFS_ENABLED, 401
  82.                 .SubMenu.Add "Item 1", MFT_STRING, MFS_ENABLED + MFS_HILITE, 402
  83.                 .SubMenu.Add "/Separator/", MFT_SEPARATOR, MFS_ENABLED, 403
  84.                 .SubMenu.Add "Item 2", MFT_STRING, MFS_ENABLED + MFS_CHECKED, 404
  85.                 .CreateSubMenu "Sub Test2", MFT_STRING, MFS_ENABLED, 405
  86.                 .SubMenu.Add "Item 1", MFT_STRING, MFS_ENABLED + MFS_ENABLED, 406
  87.                 .SubMenu.Add "/Separator/", MFT_SEPARATOR, MFS_ENABLED, 407
  88.                 .SubMenu.Add "Item 2", MFT_STRING, MFS_ENABLED + MFS_DEFAULT, 408
  89.             End If
  90.         End With
  91.         mResult = mMenu.ShowMenu(Me.hWnd)
  92.         If mResult <> 0 Then MsgBox "Menu id selected = " & mResult
  93.         mMenu.MenuUnload
  94.         Set mMenu = Nothing
  95.     End If
  96. End Sub
  97.