home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Menu Repla184974172001.psc / Example.frm (.txt) next >
Encoding:
Visual Basic Form  |  2001-04-18  |  9.4 KB  |  289 lines

  1. VERSION 5.00
  2. Object = "{D9FDB204-2D4F-4C34-864A-9D9289DB746F}#19.0#0"; "Menu.ocx"
  3. Begin VB.Form Form1 
  4.    Caption         =   "Form1"
  5.    ClientHeight    =   2220
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   4020
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   2220
  11.    ScaleWidth      =   4020
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin VB.Frame Frame2 
  14.       Caption         =   "Enabled"
  15.       Height          =   1335
  16.       Left            =   2160
  17.       TabIndex        =   5
  18.       Top             =   840
  19.       Width           =   1815
  20.       Begin VB.CheckBox Check8 
  21.          Caption         =   "Animate"
  22.          Height          =   255
  23.          Left            =   720
  24.          TabIndex        =   14
  25.          Top             =   960
  26.          Value           =   1  'Checked
  27.          Width           =   975
  28.       End
  29.       Begin VB.CheckBox Check7 
  30.          Caption         =   "Paste"
  31.          Height          =   255
  32.          Left            =   960
  33.          TabIndex        =   13
  34.          Top             =   480
  35.          Width           =   735
  36.       End
  37.       Begin VB.CheckBox Check6 
  38.          Caption         =   "Copy"
  39.          Height          =   255
  40.          Left            =   960
  41.          TabIndex        =   12
  42.          Top             =   240
  43.          Value           =   1  'Checked
  44.          Width           =   735
  45.       End
  46.       Begin VB.CheckBox Check5 
  47.          Caption         =   "Cut"
  48.          Height          =   255
  49.          Left            =   120
  50.          TabIndex        =   11
  51.          Top             =   960
  52.          Value           =   1  'Checked
  53.          Width           =   855
  54.       End
  55.       Begin VB.CheckBox Check4 
  56.          Caption         =   "Exit"
  57.          Height          =   255
  58.          Left            =   960
  59.          TabIndex        =   9
  60.          Top             =   720
  61.          Value           =   1  'Checked
  62.          Width           =   615
  63.       End
  64.       Begin VB.CheckBox Check3 
  65.          Caption         =   "Delete"
  66.          Height          =   255
  67.          Left            =   120
  68.          TabIndex        =   8
  69.          Top             =   720
  70.          Value           =   1  'Checked
  71.          Width           =   855
  72.       End
  73.       Begin VB.CheckBox Check2 
  74.          Caption         =   "Save"
  75.          Height          =   255
  76.          Left            =   120
  77.          TabIndex        =   7
  78.          Top             =   480
  79.          Width           =   735
  80.       End
  81.       Begin VB.CheckBox Check1 
  82.          Caption         =   "New"
  83.          Height          =   255
  84.          Left            =   120
  85.          TabIndex        =   6
  86.          Top             =   240
  87.          Value           =   1  'Checked
  88.          Width           =   735
  89.       End
  90.    End
  91.    Begin VB.Frame Frame1 
  92.       Caption         =   "Border Style"
  93.       Height          =   975
  94.       Left            =   120
  95.       TabIndex        =   3
  96.       Top             =   840
  97.       Width           =   1935
  98.       Begin VB.ListBox List1 
  99.          Height          =   645
  100.          ItemData        =   "Example.frx":0000
  101.          Left            =   120
  102.          List            =   "Example.frx":000D
  103.          TabIndex        =   4
  104.          Top             =   240
  105.          Width           =   1695
  106.       End
  107.    End
  108.    Begin Menu_Replacement.MenuCtl Menu1 
  109.       Left            =   0
  110.       Top             =   1200
  111.       _ExtentX        =   847
  112.       _ExtentY        =   847
  113.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  114.          Name            =   "Arial"
  115.          Size            =   9.75
  116.          Charset         =   0
  117.          Weight          =   700
  118.          Underline       =   0   'False
  119.          Italic          =   0   'False
  120.          Strikethrough   =   0   'False
  121.       EndProperty
  122.       OpenAnimated    =   -1  'True
  123.    End
  124.    Begin VB.CommandButton Command3 
  125.       Caption         =   "Click + Icons"
  126.       Height          =   615
  127.       Left            =   2760
  128.       TabIndex        =   2
  129.       Top             =   120
  130.       Width           =   1215
  131.    End
  132.    Begin VB.CommandButton Command2 
  133.       Caption         =   "Mouse Down"
  134.       Height          =   615
  135.       Left            =   1440
  136.       TabIndex        =   1
  137.       Top             =   120
  138.       Width           =   1215
  139.    End
  140.    Begin VB.CommandButton Command1 
  141.       Caption         =   "Click"
  142.       Height          =   615
  143.       Left            =   120
  144.       TabIndex        =   0
  145.       Top             =   120
  146.       Width           =   1215
  147.    End
  148.    Begin VB.Image Image6 
  149.       Height          =   240
  150.       Left            =   360
  151.       Picture         =   "Example.frx":002C
  152.       Top             =   1920
  153.       Visible         =   0   'False
  154.       Width           =   240
  155.    End
  156.    Begin VB.Image Image5 
  157.       Height          =   240
  158.       Left            =   0
  159.       Picture         =   "Example.frx":03B6
  160.       Top             =   1920
  161.       Visible         =   0   'False
  162.       Width           =   240
  163.    End
  164.    Begin VB.Image Image4 
  165.       Height          =   240
  166.       Left            =   0
  167.       Picture         =   "Example.frx":0740
  168.       Top             =   1680
  169.       Visible         =   0   'False
  170.       Width           =   240
  171.    End
  172.    Begin VB.Label Label1 
  173.       Caption         =   "By Daniel Taylor..."
  174.       Height          =   255
  175.       Left            =   120
  176.       TabIndex        =   10
  177.       Top             =   1920
  178.       Width           =   1935
  179.    End
  180.    Begin VB.Image Image3 
  181.       Height          =   240
  182.       Left            =   0
  183.       Picture         =   "Example.frx":0ACA
  184.       Top             =   840
  185.       Visible         =   0   'False
  186.       Width           =   240
  187.    End
  188.    Begin VB.Image Image2 
  189.       Height          =   240
  190.       Left            =   0
  191.       Picture         =   "Example.frx":0E54
  192.       Top             =   600
  193.       Visible         =   0   'False
  194.       Width           =   240
  195.    End
  196.    Begin VB.Image Image1 
  197.       Height          =   240
  198.       Left            =   0
  199.       Picture         =   "Example.frx":11DE
  200.       Top             =   360
  201.       Visible         =   0   'False
  202.       Width           =   240
  203.    End
  204. Attribute VB_Name = "Form1"
  205. Attribute VB_GlobalNameSpace = False
  206. Attribute VB_Creatable = False
  207. Attribute VB_PredeclaredId = True
  208. Attribute VB_Exposed = False
  209. 'Example for Menu.ocx Windows Menu Replacement Control
  210. 'Created By Daniel Taylor on 17 April 2001
  211. 'This code just demonstrates the use of my Menu.ocx file.
  212. 'it shows how to make a menu, have it show, and get the
  213. 'results when its clicked on and respond to these results.
  214. 'It just shows off a little of what you can do with the menu
  215. 'Also, the colors are all changable, try experimenting, and
  216. 'As always if you like the code, VOTE!!!!(Font is changeable, too)
  217. '::::::To use it:::::
  218. 'first make a menu using the
  219. '.AddItem ItemText, [Enabled], [Icon]
  220. 'then once all done, just show the menu using
  221. '.ShowMenu [X], [Y]
  222. 'If X & Y are not specified, it opens where the cursor is at
  223. 'When the mouse is let up the menu closes and gives back the
  224. 'Index and Text of the Item clicked, and then i set it up
  225. 'to either display certain messages or to exit the program.
  226. 'Also, I used a few image controls instead of an imagelist,
  227. 'but i think it would be easier to use the imagelist for the icons...
  228. Private Sub Check8_Click()
  229.     'tell the menu to open animated if check8 is checked,
  230.     'else, don't animate
  231.     Menu1.OpenAnimated = Check8
  232. End Sub
  233. Private Sub Command1_Click()
  234.     'create normal menu, no icons
  235.     Menu1.AddItem "New...", Check1
  236.     Menu1.AddItem "Save...", Check2
  237.     Menu1.AddItem "Delete...", Check3
  238.     Menu1.AddItem "Seperator"
  239.     Menu1.AddItem "Cut", Check5
  240.     Menu1.AddItem "Copy", Check6
  241.     Menu1.AddItem "Paste", Check7
  242.     Menu1.AddItem "seperator"
  243.     Menu1.AddItem "Exit", Check4
  244.     'show the menu
  245.     Menu1.ShowMenu
  246. End Sub
  247. Private Sub Command2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  248.     'just make and show the menu again
  249.     Call Command1_Click
  250. End Sub
  251. Private Sub Command3_click()
  252.     'this time build it with icons...
  253.     'set the icon usage to true
  254.     'don't specify an icon, and the space next to the text
  255.     'is blank, just like the windows menus... (i.e. the exit item)
  256.     Menu1.UseIcons = True
  257.     Menu1.AddItem "New...", Check1, Image1.Picture
  258.     Menu1.AddItem "Save...", Check2, Image2.Picture
  259.     Menu1.AddItem "Delete...", Check3, Image3.Picture
  260.     Menu1.AddItem "Seperator"
  261.     Menu1.AddItem "Cut", Check5, Image4.Picture
  262.     Menu1.AddItem "Copy", Check6, Image5.Picture
  263.     Menu1.AddItem "Paste", Check7, Image6.Picture
  264.     Menu1.AddItem "seperator"
  265.     Menu1.AddItem "Exit", Check4
  266.     'once again show the menu
  267.     Menu1.ShowMenu
  268.     'make sure to reset the icon usage
  269.     Menu1.UseIcons = False
  270. End Sub
  271. Private Sub Form_Load()
  272.     List1.ListIndex = 0
  273. End Sub
  274. Private Sub List1_Click()
  275.     'change the borderstyle of the menu
  276.     Menu1.Style = List1.ListIndex
  277. End Sub
  278. Private Sub Menu1_ItemClicked(Index As Integer, Text As String)
  279.     'get results of menu when it closes, then process the text
  280.     If Text = "Exit" Then
  281.         DoEvents
  282.         Unload Me
  283.     ElseIf Text = "New..." Then
  284.         MsgBox "New Not Possible..."
  285.     Else
  286.         MsgBox "You clicked an item with the index of " & Index & " and the text: " & Text
  287.     End If
  288. End Sub
  289.