home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Audio / Office2010 / InfoPath.en-us / InfLR.cab / FL_AddMenuItemsToAWindowsForm_snippet_142612_ENU____.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Extensible Markup Language  |  2008-09-17  |  2KB  |  61 lines

  1. <?xml version="1.0"?>
  2. <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  3.   <CodeSnippet Format="1.0.0">
  4.     <Header>
  5.       <Title>Add Menu Items to Windows Forms</Title>
  6.       <Author>Microsoft Corporation</Author>
  7.         <Description>Adds menu items to an existing menu</Description>
  8.       <Shortcut>menuAddItems</Shortcut>
  9.     </Header>
  10.     <Snippet>
  11.       <References>
  12.         <Reference>
  13.           <Assembly>System.Windows.Forms.dll</Assembly>
  14.         </Reference>
  15.       </References>
  16.       <Imports>
  17.         <Import>
  18.           <Namespace>System.Windows.Forms</Namespace>
  19.         </Import>
  20.       </Imports>
  21.       <Declarations>
  22.         <Literal>
  23.           <ID>secondDropDownName</ID>
  24.           <Type>String</Type>
  25.           <ToolTip>Replace with text for the second dropdown item in the menu. Use "&" to create accelerator keys.</ToolTip>
  26.           <Default>"&Second Item"</Default>
  27.         </Literal>
  28.         <Literal>
  29.           <ID>firstDropDownName</ID>
  30.           <Type>String</Type>
  31.           <ToolTip>Replace with text for the first dropdown item in the menu. Use "&" to create accelerator keys.</ToolTip>
  32.           <Default>"&First Item"</Default>
  33.         </Literal>
  34.         <Literal>
  35.           <ID>menuStripName</ID>
  36.           <Type>MenuStrip</Type>
  37.           <ToolTip>Replace with a MenuStrip on your form.</ToolTip>
  38.           <Default>MenuStrip1</Default>
  39.         </Literal>
  40.         <Literal>
  41.           <ID>menuName</ID>
  42.           <Type>String</Type>
  43.           <ToolTip>Replace with the name of the added menu. </ToolTip>
  44.           <Default>"&Menu Name"</Default>
  45.         </Literal>
  46.       </Declarations>
  47.       <Code Language="VB" Kind="method body"><![CDATA[Dim addedMenuStripItem As New ToolStripMenuItem
  48. Dim firstDropDownItem As New ToolStripMenuItem
  49. Dim secondDropDownItem As New ToolStripMenuItem
  50.  
  51. addedMenuStripItem.Text = $menuName$
  52. firstDropDownItem.Text = $firstDropDownName$
  53. secondDropDownItem.Text = $secondDropDownName$
  54.  
  55. $menuStripName$.Items.Add(addedMenuStripItem)
  56.  
  57. addedMenuStripItem.DropDownItems.Add(firstDropDownItem)
  58. addedMenuStripItem.DropDownItems.Add(secondDropDownItem)]]></Code>
  59.     </Snippet>
  60.   </CodeSnippet>
  61. </CodeSnippets>