-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
MenuItem.xml
1968 lines (1784 loc) · 142 KB
/
MenuItem.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<Type Name="MenuItem" FullName="System.Windows.Forms.MenuItem">
<TypeSignature Language="C#" Value="public class MenuItem : System.Windows.Forms.Menu" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit MenuItem extends System.Windows.Forms.Menu" />
<TypeSignature Language="DocId" Value="T:System.Windows.Forms.MenuItem" />
<TypeSignature Language="VB.NET" Value="Public Class MenuItem
Inherits Menu" />
<TypeSignature Language="F#" Value="type MenuItem = class
 inherit Menu" />
<TypeSignature Language="C++ CLI" Value="public ref class MenuItem : System::Windows::Forms::Menu" />
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Windows.Forms.Menu</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.DefaultEvent("Click")]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.DefaultEvent("Click")>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.DefaultProperty("Text")]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.DefaultProperty("Text")>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.DesignTimeVisible(false)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.DesignTimeVisible(false)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.ToolboxItem(false)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.ToolboxItem(false)>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Represents an individual item that is displayed within a <see cref="T:System.Windows.Forms.MainMenu" /> or <see cref="T:System.Windows.Forms.ContextMenu" />.
This class is not available in .NET Core 3.1 and later versions. Use <see cref="T:System.Windows.Forms.ToolStripMenuItem" /> instead, which replaces the <see cref="T:System.Windows.Forms.MenuItem" /> control.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This class is not available in .NET Core 3.1 and later versions. Use <xref:System.Windows.Forms.ToolStripMenuItem> instead.
In order for a <xref:System.Windows.Forms.MenuItem> to be displayed, you must add it to a <xref:System.Windows.Forms.MainMenu> or <xref:System.Windows.Forms.ContextMenu>. To create submenus, you can add <xref:System.Windows.Forms.MenuItem> objects to the <xref:System.Windows.Forms.Menu.MenuItems%2A> property of the parent <xref:System.Windows.Forms.MenuItem>.
The <xref:System.Windows.Forms.MenuItem> class provides properties that enable you to configure the appearance and functionality of a menu item. To display a check mark next to a menu item, use the <xref:System.Windows.Forms.MenuItem.Checked%2A> property. You can use this feature to identify a menu item that is selected in a list of mutually exclusive menu items. For example, if you have a set of menu items for setting the color of text in a <xref:System.Windows.Forms.TextBox> control, you can use the <xref:System.Windows.Forms.MenuItem.Checked%2A> property to identify which color is currently selected. The <xref:System.Windows.Forms.MenuItem.Shortcut%2A> property can be used to define a keyboard combination that can be pressed to select the menu item.
For <xref:System.Windows.Forms.MenuItem> objects displayed in a Multiple Document Interface (MDI) application, you can use the <xref:System.Windows.Forms.MenuItem.MergeMenu%2A> method to merge the menus of an MDI parent for with that of its child forms to create a consolidated menu structure. Because a <xref:System.Windows.Forms.MenuItem> cannot be reused in multiple locations at the same time, such as in a <xref:System.Windows.Forms.MainMenu> and a <xref:System.Windows.Forms.ContextMenu>, you can use the <xref:System.Windows.Forms.MenuItem.CloneMenu%2A> method to create a copy of a <xref:System.Windows.Forms.MenuItem> for use in another location.
The <xref:System.Windows.Forms.MenuItem.Popup> event enables you to perform tasks before a menu is displayed. For example, you can create an event handler for this event to display or hide menu items based on the state of your code. The <xref:System.Windows.Forms.MenuItem.Select> event enables you to perform tasks such as providing detailed help for your application's menu items when the user places the mouse pointer over a menu item.
## Examples
The following code example creates a menu structure for a form. The example code adds a <xref:System.Windows.Forms.MenuItem> to represent the top-level menu item, adds a submenu item to it for selecting a font size, and then adds two submenu items to that menu item that represent large and small font choices in an application. The example requires that there is a <xref:System.Windows.Forms.MainMenu> object named `mainMenu1` and four <xref:System.Windows.Forms.MenuItem> objects named `menuItem1`, `menuItem2`, `menuItem3`, and `menuItem4`.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic Menu Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Menu/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic Menu Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="T:System.Windows.Forms.MainMenu" />
<altmember cref="T:System.Windows.Forms.Menu" />
<altmember cref="T:System.Windows.Forms.MenuMerge" />
<altmember cref="T:System.Windows.Forms.ContextMenu" />
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Windows.Forms.MenuItem" /> class.</summary>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public MenuItem ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.MenuItem.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:
 MenuItem();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters />
<Docs>
<summary>Initializes a <see cref="T:System.Windows.Forms.MenuItem" /> with a blank caption.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Once you have created a blank <xref:System.Windows.Forms.MenuItem> using this constructor, you can use the properties and methods of the <xref:System.Windows.Forms.MenuItem> class to specify the appearance and behavior of your <xref:System.Windows.Forms.MenuItem>.
## Examples
The following code example creates a <xref:System.Windows.Forms.MenuItem> using this version of the constructor.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/.ctor/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic MenuItem.MenuItem Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public MenuItem (string text);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string text) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.MenuItem.#ctor(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (text As String)" />
<MemberSignature Language="F#" Value="new System.Windows.Forms.MenuItem : string -> System.Windows.Forms.MenuItem" Usage="new System.Windows.Forms.MenuItem text" />
<MemberSignature Language="C++ CLI" Value="public:
 MenuItem(System::String ^ text);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="text" Type="System.String" />
</Parameters>
<Docs>
<param name="text">The caption for the menu item.</param>
<summary>Initializes a new instance of the <see cref="T:System.Windows.Forms.MenuItem" /> class with a specified caption for the menu item.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When you specify a caption for your menu item with the `text` parameter, you can also specify an access key by placing an '&' character before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the `text` parameter to "`-`" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.
## Examples
The following code example creates a <xref:System.Windows.Forms.MenuItem> that specifies the caption of the menu item at the time it is constructed.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem1 Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/.ctor/source1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic MenuItem.MenuItem1 Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public MenuItem (string text, EventHandler onClick);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string text, class System.EventHandler onClick) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.MenuItem.#ctor(System.String,System.EventHandler)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (text As String, onClick As EventHandler)" />
<MemberSignature Language="F#" Value="new System.Windows.Forms.MenuItem : string * EventHandler -> System.Windows.Forms.MenuItem" Usage="new System.Windows.Forms.MenuItem (text, onClick)" />
<MemberSignature Language="C++ CLI" Value="public:
 MenuItem(System::String ^ text, EventHandler ^ onClick);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="text" Type="System.String" />
<Parameter Name="onClick" Type="System.EventHandler" />
</Parameters>
<Docs>
<param name="text">The caption for the menu item.</param>
<param name="onClick">The <see cref="T:System.EventHandler" /> that handles the <see cref="E:System.Windows.Forms.MenuItem.Click" /> event for this menu item.</param>
<summary>Initializes a new instance of the class with a specified caption and event handler for the <see cref="E:System.Windows.Forms.MenuItem.Click" /> event of the menu item.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When you specify a caption for your menu item with the `text` parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the `text` parameter to "`-`" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.
In addition, you can use this constructor to specify a delegate that will handle the <xref:System.Windows.Forms.MenuItem.Click> event for the menu item being created. The <xref:System.EventHandler> that you pass to this constructor must be configured to call an event handler that can handle the <xref:System.Windows.Forms.MenuItem.Click> event. For more information on handling events, see [Handling and Raising Events](/dotnet/standard/events/).
## Examples
The following code example creates a <xref:System.Windows.Forms.MenuItem> object with a specified caption and an <xref:System.EventHandler> delegate connected to an event handler that will handle the <xref:System.Windows.Forms.MenuItem.Click> event for the menu item.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem2 Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/.ctor/source2.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic MenuItem.MenuItem2 Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public MenuItem (string text, System.Windows.Forms.MenuItem[] items);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string text, class System.Windows.Forms.MenuItem[] items) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.MenuItem.#ctor(System.String,System.Windows.Forms.MenuItem[])" />
<MemberSignature Language="VB.NET" Value="Public Sub New (text As String, items As MenuItem())" />
<MemberSignature Language="F#" Value="new System.Windows.Forms.MenuItem : string * System.Windows.Forms.MenuItem[] -> System.Windows.Forms.MenuItem" Usage="new System.Windows.Forms.MenuItem (text, items)" />
<MemberSignature Language="C++ CLI" Value="public:
 MenuItem(System::String ^ text, cli::array <System::Windows::Forms::MenuItem ^> ^ items);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="text" Type="System.String" />
<Parameter Name="items" Type="System.Windows.Forms.MenuItem[]" />
</Parameters>
<Docs>
<param name="text">The caption for the menu item.</param>
<param name="items">An array of <see cref="T:System.Windows.Forms.MenuItem" /> objects that contains the submenu items for this menu item.</param>
<summary>Initializes a new instance of the class with a specified caption and an array of submenu items defined for the menu item.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When you specify a caption for your menu item with the `text` parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the `text` parameter to "`-`" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.
The `items` parameter enables you to assign an array of menu items to define a submenu of this menu item. Each item in the array can also have an array of menu items assigned to it. This enables you to create complete menu structures and assign them to the constructor for the menu item.
For more information on handling events, see [Handling and Raising Events](/dotnet/standard/events/).
## Examples
The following code example creates an object with a specified caption, an event handler connected to a method that will handle the event each menu item in an array of submenu items.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem4 Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/.ctor/source4.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic MenuItem.MenuItem4 Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public MenuItem (string text, EventHandler onClick, System.Windows.Forms.Shortcut shortcut);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string text, class System.EventHandler onClick, valuetype System.Windows.Forms.Shortcut shortcut) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.MenuItem.#ctor(System.String,System.EventHandler,System.Windows.Forms.Shortcut)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (text As String, onClick As EventHandler, shortcut As Shortcut)" />
<MemberSignature Language="F#" Value="new System.Windows.Forms.MenuItem : string * EventHandler * System.Windows.Forms.Shortcut -> System.Windows.Forms.MenuItem" Usage="new System.Windows.Forms.MenuItem (text, onClick, shortcut)" />
<MemberSignature Language="C++ CLI" Value="public:
 MenuItem(System::String ^ text, EventHandler ^ onClick, System::Windows::Forms::Shortcut shortcut);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="text" Type="System.String" />
<Parameter Name="onClick" Type="System.EventHandler" />
<Parameter Name="shortcut" Type="System.Windows.Forms.Shortcut" />
</Parameters>
<Docs>
<param name="text">The caption for the menu item.</param>
<param name="onClick">The <see cref="T:System.EventHandler" /> that handles the <see cref="E:System.Windows.Forms.MenuItem.Click" /> event for this menu item.</param>
<param name="shortcut">One of the <see cref="T:System.Windows.Forms.Shortcut" /> values.</param>
<summary>Initializes a new instance of the class with a specified caption, event handler, and associated shortcut key for the menu item.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When you specify a caption for your menu item with the `text` parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus. This constructor also enables you to specify a shortcut key in addition to an access key to provide keyboard navigation. Shortcut keys allow you to specify a combination of keys that can be used to activate the menu item.
Setting the `text` parameter to "`-`" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.
In addition, you can use this constructor to specify a delegate that will handle the <xref:System.Windows.Forms.MenuItem.Click> event for the menu item being created. The <xref:System.EventHandler> that you pass to this constructor must be configured to call an event handler that can handle the <xref:System.Windows.Forms.MenuItem.Click> event. For more information on handling events, see [Handling and Raising Events](/dotnet/standard/events/).
## Examples
The following code example creates an object with a specified caption, shortcut key, and an event handler connected to a method that will handle the event for the menu item.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem3 Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/.ctor/source3.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic MenuItem.MenuItem3 Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public MenuItem (System.Windows.Forms.MenuMerge mergeType, int mergeOrder, System.Windows.Forms.Shortcut shortcut, string text, EventHandler onClick, EventHandler onPopup, EventHandler onSelect, System.Windows.Forms.MenuItem[] items);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(valuetype System.Windows.Forms.MenuMerge mergeType, int32 mergeOrder, valuetype System.Windows.Forms.Shortcut shortcut, string text, class System.EventHandler onClick, class System.EventHandler onPopup, class System.EventHandler onSelect, class System.Windows.Forms.MenuItem[] items) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.MenuItem.#ctor(System.Windows.Forms.MenuMerge,System.Int32,System.Windows.Forms.Shortcut,System.String,System.EventHandler,System.EventHandler,System.EventHandler,System.Windows.Forms.MenuItem[])" />
<MemberSignature Language="VB.NET" Value="Public Sub New (mergeType As MenuMerge, mergeOrder As Integer, shortcut As Shortcut, text As String, onClick As EventHandler, onPopup As EventHandler, onSelect As EventHandler, items As MenuItem())" />
<MemberSignature Language="F#" Value="new System.Windows.Forms.MenuItem : System.Windows.Forms.MenuMerge * int * System.Windows.Forms.Shortcut * string * EventHandler * EventHandler * EventHandler * System.Windows.Forms.MenuItem[] -> System.Windows.Forms.MenuItem" Usage="new System.Windows.Forms.MenuItem (mergeType, mergeOrder, shortcut, text, onClick, onPopup, onSelect, items)" />
<MemberSignature Language="C++ CLI" Value="public:
 MenuItem(System::Windows::Forms::MenuMerge mergeType, int mergeOrder, System::Windows::Forms::Shortcut shortcut, System::String ^ text, EventHandler ^ onClick, EventHandler ^ onPopup, EventHandler ^ onSelect, cli::array <System::Windows::Forms::MenuItem ^> ^ items);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="mergeType" Type="System.Windows.Forms.MenuMerge" />
<Parameter Name="mergeOrder" Type="System.Int32" />
<Parameter Name="shortcut" Type="System.Windows.Forms.Shortcut" />
<Parameter Name="text" Type="System.String" />
<Parameter Name="onClick" Type="System.EventHandler" />
<Parameter Name="onPopup" Type="System.EventHandler" />
<Parameter Name="onSelect" Type="System.EventHandler" />
<Parameter Name="items" Type="System.Windows.Forms.MenuItem[]" />
</Parameters>
<Docs>
<param name="mergeType">One of the <see cref="T:System.Windows.Forms.MenuMerge" /> values.</param>
<param name="mergeOrder">The relative position that this menu item will take in a merged menu.</param>
<param name="shortcut">One of the <see cref="T:System.Windows.Forms.Shortcut" /> values.</param>
<param name="text">The caption for the menu item.</param>
<param name="onClick">The <see cref="T:System.EventHandler" /> that handles the <see cref="E:System.Windows.Forms.MenuItem.Click" /> event for this menu item.</param>
<param name="onPopup">The <see cref="T:System.EventHandler" /> that handles the <see cref="E:System.Windows.Forms.MenuItem.Popup" /> event for this menu item.</param>
<param name="onSelect">The <see cref="T:System.EventHandler" /> that handles the <see cref="E:System.Windows.Forms.MenuItem.Select" /> event for this menu item.</param>
<param name="items">An array of <see cref="T:System.Windows.Forms.MenuItem" /> objects that contains the submenu items for this menu item.</param>
<summary>Initializes a new instance of the <see cref="T:System.Windows.Forms.MenuItem" /> class with a specified caption; defined event-handlers for the <see cref="E:System.Windows.Forms.MenuItem.Click" />, <see cref="E:System.Windows.Forms.MenuItem.Select" /> and <see cref="E:System.Windows.Forms.MenuItem.Popup" /> events; a shortcut key; a merge type; and order specified for the menu item.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When you specify a caption for your menu item with the `text` parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the `text` parameter to "`-`" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.
The `items` parameter enables you to assign an array of menu items to define a submenu of this menu item. Each item in the array can also have an array of menu items assigned to it. This enables you to create complete menu structures and assign them to the constructor for the menu item.
The `mergeType` and `mergeOrder` parameters allow you to determine how this menu item will behave when the menu item is merged with another menu. Depending on the value you specify for the `mergeType` parameter, you can either add, remove, replace, or merge the menu item and its submenu items with the menu that it is merging with. The `mergeOrder` parameter determines where the menu item being created will be positioned when the menu is merged.
In addition, you can use this constructor to create a <xref:System.Windows.Forms.MenuItem> and have it connected to an event handler in your code that will process the click of the menu item. The <xref:System.EventHandler> that you pass into this constructor should be configured to call an event handler that can handle the <xref:System.Windows.Forms.MenuItem.Click> event. By using this constructor version, you can also connect the <xref:System.Windows.Forms.MenuItem.Popup> and <xref:System.Windows.Forms.MenuItem.Select> events to determine when this menu item is selected. You can use these events for tasks such as determining whether or not to display a check mark next to submenu items or to enable or disable menu items based on the state of the application. The <xref:System.Windows.Forms.MenuItem.Select> and <xref:System.Windows.Forms.MenuItem.Click> events are raised only for <xref:System.Windows.Forms.MenuItem> objects that are not parent menu items. For more information on handling events, see [Handling and Raising Events](/dotnet/standard/events/).
## Examples
The following code example creates a menu item that has a caption and shortcut key. The menu item also has event handlers defined for the <xref:System.Windows.Forms.MenuItem.Popup>, <xref:System.Windows.Forms.MenuItem.Click>, and <xref:System.Windows.Forms.MenuItem.Select> events. If this menu item is merged, it will add the menu item to the menu with the merge order of zero.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem5 Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/.ctor/source5.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic MenuItem.MenuItem5 Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="E:System.Windows.Forms.MenuItem.Popup" />
<altmember cref="E:System.Windows.Forms.MenuItem.Select" />
<altmember cref="E:System.Windows.Forms.MenuItem.Click" />
<altmember cref="P:System.Windows.Forms.MenuItem.MergeType" />
<altmember cref="P:System.Windows.Forms.MenuItem.MergeOrder" />
</Docs>
</Member>
<Member MemberName="BarBreak">
<MemberSignature Language="C#" Value="public bool BarBreak { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool BarBreak" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.MenuItem.BarBreak" />
<MemberSignature Language="VB.NET" Value="Public Property BarBreak As Boolean" />
<MemberSignature Language="F#" Value="member this.BarBreak : bool with get, set" Usage="System.Windows.Forms.MenuItem.BarBreak" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool BarBreak { bool get(); void set(bool value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.Browsable(false)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.Browsable(false)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.DefaultValue(false)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.DefaultValue(false)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the <see cref="T:System.Windows.Forms.MenuItem" /> is placed on a new line (for a menu item added to a <see cref="T:System.Windows.Forms.MainMenu" /> object) or in a new column (for a submenu item or menu item displayed in a <see cref="T:System.Windows.Forms.ContextMenu" />).</summary>
<value>
<see langword="true" /> if the menu item is placed on a new line or in a new column; <see langword="false" /> if the menu item is left in its default placement. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can use the <xref:System.Windows.Forms.MenuItem.BarBreak%2A> property to create a menu where each menu item is placed next to each other horizontally instead of in a vertical list. You can also use this property to create a menu bar that contains multiple rows of top-level menu items.
This property differs from the <xref:System.Windows.Forms.MenuItem.Break%2A> property in that a bar is displayed on the left edge of each menu item that has the <xref:System.Windows.Forms.MenuItem.Break%2A> property set to `true`. The bar is only displayed when the menu item is not a top-level menu item.
## Examples
The following code example creates a <xref:System.Windows.Forms.MenuItem> with two submenu items. The two submenu items are displayed horizontally instead of vertically using the <xref:System.Windows.Forms.MenuItem.BarBreak%2A> property.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.BarBreak Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/BarBreak/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic MenuItem.BarBreak Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.MenuItem.Break" />
</Docs>
</Member>
<Member MemberName="Break">
<MemberSignature Language="C#" Value="public bool Break { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool Break" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.MenuItem.Break" />
<MemberSignature Language="VB.NET" Value="Public Property Break As Boolean" />
<MemberSignature Language="F#" Value="member this.Break : bool with get, set" Usage="System.Windows.Forms.MenuItem.Break" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool Break { bool get(); void set(bool value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.Browsable(false)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.Browsable(false)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.DefaultValue(false)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.DefaultValue(false)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the item is placed on a new line (for a menu item added to a <see cref="T:System.Windows.Forms.MainMenu" /> object) or in a new column (for a menu item or submenu item displayed in a <see cref="T:System.Windows.Forms.ContextMenu" />).</summary>
<value>
<see langword="true" /> if the menu item is placed on a new line or in a new column; <see langword="false" /> if the menu item is left in its default placement. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can use the <xref:System.Windows.Forms.MenuItem.Break%2A> property to create a menu where each menu is placed next to each other horizontally instead of in a vertical list. You can also use this property to create a menu bar that contains multiple rows of top-level menu items.
## Examples
The following code example creates a menu with two top-level menu items on the top row and one menu item on the bottom row.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Break Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/Break/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic MenuItem.Break Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.MenuItem.BarBreak" />
</Docs>
</Member>
<Member MemberName="Checked">
<MemberSignature Language="C#" Value="public bool Checked { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool Checked" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.MenuItem.Checked" />
<MemberSignature Language="VB.NET" Value="Public Property Checked As Boolean" />
<MemberSignature Language="F#" Value="member this.Checked : bool with get, set" Usage="System.Windows.Forms.MenuItem.Checked" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool Checked { bool get(); void set(bool value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.DefaultValue(false)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.DefaultValue(false)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether a check mark appears next to the text of the menu item.</summary>
<value>
<see langword="true" /> if there is a check mark next to the menu item; otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can use the <xref:System.Windows.Forms.MenuItem.Checked%2A> property in combination with other menu items in a menu to provide state for an application. For example, you can place a check mark on a menu item in a group of items to identify the size of the font to be displayed for the text in an application. You can also use the <xref:System.Windows.Forms.MenuItem.Checked%2A> property to identify the selected menu item in a group of mutually exclusive menu items.
> [!NOTE]
> This property cannot be set to `true` for top-level menu items.
## Examples
The following code example uses the <xref:System.Windows.Forms.MenuItem.Checked%2A> property to provide the state in an application. In this example, a group of menu items are used to specify the color for the text in a <xref:System.Windows.Forms.TextBox> control. The event handler provided is used by the <xref:System.Windows.Forms.MenuItem.Click> event of three menu items. Each menu item specifies a text color, `menuItemRed` (Red), `menuItemGreen` (Green), or `menuItemBlue` (Blue). The event handler determines which menu item was clicked, places a checkmark to the selected menu item, and changes the text color of the form's <xref:System.Windows.Forms.TextBox> control. The example requires that the <xref:System.Drawing> namespace has been added to the form that this code is placed in. The example also requires that a <xref:System.Windows.Forms.TextBox> has been added to the form that this example code is located in that is named `textBox1`.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Checked Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/Checked/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic MenuItem.Checked Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The <see cref="T:System.Windows.Forms.MenuItem" /> is a top-level menu or has children.</exception>
</Docs>
</Member>
<Member MemberName="Click">
<MemberSignature Language="C#" Value="public event EventHandler Click;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler Click" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.MenuItem.Click" />
<MemberSignature Language="VB.NET" Value="Public Custom Event Click As EventHandler " />
<MemberSignature Language="F#" Value="member this.Click : EventHandler " Usage="member this.Click : System.EventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event EventHandler ^ Click;" />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the menu item is clicked or selected using a shortcut key or access key defined for the menu item.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Windows.Forms.MenuItem.Click> event occurs when this <xref:System.Windows.Forms.MenuItem> is clicked by the user. This event also occurs if the user selects the menu item using the keyboard and presses the Enter key. It can also occur if an access key or shortcut key is pressed that is associated with the <xref:System.Windows.Forms.MenuItem>. For more information about handling events, see [Handling and Raising Events](/dotnet/standard/events/).
> [!NOTE]
> If the <xref:System.Windows.Forms.Menu.MenuItems%2A> property for the <xref:System.Windows.Forms.MenuItem> contains any items, this event is not raised. This event is not raised for parent menu items.
## Examples
The following code example demonstrates how to use the <xref:System.Windows.Forms.MenuItem.Click> event to perform tasks when a <xref:System.Windows.Forms.MenuItem> is clicked. The example creates a <xref:System.Windows.Forms.MainMenu> called `mainMenu1` and adds two <xref:System.Windows.Forms.MenuItem> objects, `topMenuItem` (`File`) and `menuItem1` (`Open`). It then connects the `Click` event to the `menuItem1_Click` event handler. When the user clicks the `Open` menu item, an <xref:System.Windows.Forms.OpenFileDialog> is initialized and displayed. The example requires that you have created a <xref:System.Windows.Forms.Form> named `Form1`.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/MenuItemClick/CPP/form1.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/Click/form1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/MenuItemClick/VB/form1.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<MemberGroup MemberName="CloneMenu">
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Creates a copy of a <see cref="T:System.Windows.Forms.MenuItem" />.</summary>
</Docs>
</MemberGroup>
<Member MemberName="CloneMenu">
<MemberSignature Language="C#" Value="public virtual System.Windows.Forms.MenuItem CloneMenu ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Windows.Forms.MenuItem CloneMenu() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.MenuItem.CloneMenu" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function CloneMenu () As MenuItem" />
<MemberSignature Language="F#" Value="override this.CloneMenu : unit -> System.Windows.Forms.MenuItem" Usage="menuItem.CloneMenu " />
<MemberSignature Language="C++ CLI" Value="public:
 virtual System::Windows::Forms::MenuItem ^ CloneMenu();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Forms.MenuItem</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Creates a copy of the current <see cref="T:System.Windows.Forms.MenuItem" />.</summary>
<returns>A <see cref="T:System.Windows.Forms.MenuItem" /> that represents the duplicated menu item.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Windows.Forms.MenuItem> objects cannot be used in more than one place unless you obtain a copy of the <xref:System.Windows.Forms.MenuItem>. You can call this method to create a copy of this menu item for use in a <xref:System.Windows.Forms.ContextMenu>, <xref:System.Windows.Forms.MainMenu>, or other <xref:System.Windows.Forms.MenuItem> within your application. When a menu item is cloned, any event handlers specified in the original menu item will continue to function in the cloned version of the menu item. For example, if you created a <xref:System.Windows.Forms.MenuItem> and connected its <xref:System.Windows.Forms.MenuItem.Click> event to an event handler. When the menu item is cloned, the cloned menu item will call the same event handler.
## Examples
The following code example clones a <xref:System.Windows.Forms.MenuItem> and displays it in a <xref:System.Windows.Forms.ContextMenu>. The example requires that a <xref:System.Windows.Forms.MenuItem> exists in a <xref:System.Windows.Forms.MainMenu> on a form with the name of `menuItem1` and that a <xref:System.Windows.Forms.ContextMenu> object named `contextMenu1` also exists on the form.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/CloneMenu/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic MenuItem.CloneMenu Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="CloneMenu">
<MemberSignature Language="C#" Value="protected void CloneMenu (System.Windows.Forms.MenuItem itemSrc);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig instance void CloneMenu(class System.Windows.Forms.MenuItem itemSrc) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.MenuItem.CloneMenu(System.Windows.Forms.MenuItem)" />
<MemberSignature Language="VB.NET" Value="Protected Sub CloneMenu (itemSrc As MenuItem)" />
<MemberSignature Language="F#" Value="override this.CloneMenu : System.Windows.Forms.MenuItem -> unit" Usage="menuItem.CloneMenu itemSrc" />
<MemberSignature Language="C++ CLI" Value="protected:
 void CloneMenu(System::Windows::Forms::MenuItem ^ itemSrc);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="itemSrc" Type="System.Windows.Forms.MenuItem" />
</Parameters>
<Docs>
<param name="itemSrc">The <see cref="T:System.Windows.Forms.MenuItem" /> that represents the menu item to copy.</param>
<summary>Creates a copy of the specified <see cref="T:System.Windows.Forms.MenuItem" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Call this method to create copies of menu items that you have already created for use in a shortcut menu or another menu structure within your application. This version of <xref:System.Windows.Forms.MenuItem.CloneMenu%2A> allows you to specify a specific <xref:System.Windows.Forms.MenuItem> to copy instead of the menu item that is calling the method. You can use this method to initialize a new <xref:System.Windows.Forms.MenuItem> object with a copy of another <xref:System.Windows.Forms.MenuItem>. When a menu item is cloned, any event handlers specified in the original menu item will continue to function in the cloned version of the menu item. For example, if you created a <xref:System.Windows.Forms.MenuItem> and connected its <xref:System.Windows.Forms.MenuItem.Click> event to an event handler. When the menu item is cloned, the cloned menu item will call the same event handler.
## Examples
The following code example initializes a new <xref:System.Windows.Forms.MenuItem> with a copy of an existing <xref:System.Windows.Forms.MenuItem> that is used in a <xref:System.Windows.Forms.MainMenu> on a form. The code then adds the cloned <xref:System.Windows.Forms.MenuItem> to a <xref:System.Windows.Forms.ContextMenu> on the form. This example requires that a <xref:System.Windows.Forms.MenuItem> is already created and named `menuItem1` and that a <xref:System.Windows.Forms.ContextMenu> control has been created and named `contextMenu1`.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu1 Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/CloneMenu/source1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic MenuItem.CloneMenu1 Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="DefaultItem">
<MemberSignature Language="C#" Value="public bool DefaultItem { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool DefaultItem" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.MenuItem.DefaultItem" />
<MemberSignature Language="VB.NET" Value="Public Property DefaultItem As Boolean" />
<MemberSignature Language="F#" Value="member this.DefaultItem : bool with get, set" Usage="System.Windows.Forms.MenuItem.DefaultItem" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool DefaultItem { bool get(); void set(bool value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.DefaultValue(false)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.DefaultValue(false)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the menu item is the default menu item.</summary>
<value>
<see langword="true" /> if the menu item is the default item in a menu; otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default menu item for a menu is boldfaced. When the user double-clicks a submenu that contains a default item, the default item is selected, and the submenu is closed. You can use the <xref:System.Windows.Forms.MenuItem.DefaultItem%2A> property to indicate, the default action that is expected in a menu or shortcut menu.
## Examples
The following code example creates a menu item with two submenu items. The example sets `menuItem2` as the default menu item using the <xref:System.Windows.Forms.MenuItem.DefaultItem%2A> property.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.DefaultItem Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/DefaultItem/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic MenuItem.DefaultItem Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Dispose">
<MemberSignature Language="C#" Value="protected override void Dispose (bool disposing);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void Dispose(bool disposing) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.MenuItem.Dispose(System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub Dispose (disposing As Boolean)" />
<MemberSignature Language="F#" Value="override this.Dispose : bool -> unit" Usage="menuItem.Dispose disposing" />
<MemberSignature Language="C++ CLI" Value="protected:
 override void Dispose(bool disposing);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="disposing" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="disposing">
<see langword="true" /> to release both managed and unmanaged resources; <see langword="false" /> to release only unmanaged resources.</param>
<summary>Disposes of the resources (other than memory) used by the <see cref="T:System.Windows.Forms.MenuItem" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Call <xref:System.Windows.Forms.MenuItem.Dispose%2A> when you are finished using the <xref:System.Windows.Forms.MenuItem>. The <xref:System.Windows.Forms.MenuItem.Dispose%2A> method leaves the <xref:System.Windows.Forms.MenuItem> in an unusable state. After calling <xref:System.Windows.Forms.MenuItem.Dispose%2A>, you must release all references to the <xref:System.Windows.Forms.MenuItem> so the memory it was occupying can be reclaimed by garbage collection.
> [!NOTE]
> Always call <xref:System.Windows.Forms.MenuItem.Dispose%2A> before you release your last reference to the <xref:System.Windows.Forms.MenuItem>. Otherwise, the resources the <xref:System.Windows.Forms.MenuItem> is using will not be freed until garbage collection calls the <xref:System.Windows.Forms.MenuItem> object's destructor.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="DrawItem">
<MemberSignature Language="C#" Value="public event System.Windows.Forms.DrawItemEventHandler DrawItem;" />
<MemberSignature Language="ILAsm" Value=".event class System.Windows.Forms.DrawItemEventHandler DrawItem" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.MenuItem.DrawItem" />
<MemberSignature Language="VB.NET" Value="Public Custom Event DrawItem As DrawItemEventHandler " />
<MemberSignature Language="F#" Value="member this.DrawItem : System.Windows.Forms.DrawItemEventHandler " Usage="member this.DrawItem : System.Windows.Forms.DrawItemEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event System::Windows::Forms::DrawItemEventHandler ^ DrawItem;" />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Forms.DrawItemEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the <see cref="P:System.Windows.Forms.MenuItem.OwnerDraw" /> property of a menu item is set to <see langword="true" /> and a request is made to draw the menu item.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Windows.Forms.DrawItemEventArgs> argument passed to a <xref:System.Windows.Forms.MenuItem.DrawItem> event handler provides a <xref:System.Drawing.Graphics> object that enables you to perform drawing and other graphical operations on the surface of the menu item. You can use this event handler to create custom menus that meet the needs of your application. For more information about handling events, see [Handling and Raising Events](/dotnet/standard/events/).
## Examples
The following code example demonstrates how to handle the <xref:System.Windows.Forms.MenuItem.DrawItem> event. This example draws a menu item using a <xref:System.Drawing.Brush> and a <xref:System.Drawing.Font>, and then draws a <xref:System.Drawing.Rectangle> around the menu item. The drawing is performed through the <xref:System.Drawing.Graphics> object, which is passed to the event handler in the <xref:System.Windows.Forms.DrawItemEventArgs> parameter. This example requires that you have initialized the <xref:System.Windows.Forms.MenuItem.OwnerDraw%2A> property for the item to `true`. For the C# example, add the following code in the form's constructor, after `InitializeComponent`, to hook up the event:
`this.menuItem1.DrawItem += new DrawItemEventHandler(menuItem1_DrawItem);`
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/OwnerDraw example/CPP/form1.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/DrawItem/form1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/OwnerDraw example/VB/form1.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.MenuItem.OwnerDraw" />
<altmember cref="E:System.Windows.Forms.MenuItem.MeasureItem" />
</Docs>
</Member>
<Member MemberName="Enabled">
<MemberSignature Language="C#" Value="public bool Enabled { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool Enabled" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.MenuItem.Enabled" />
<MemberSignature Language="VB.NET" Value="Public Property Enabled As Boolean" />
<MemberSignature Language="F#" Value="member this.Enabled : bool with get, set" Usage="System.Windows.Forms.MenuItem.Enabled" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool Enabled { bool get(); void set(bool value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.DefaultValue(true)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.DefaultValue(true)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.Localizable(true)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.Localizable(true)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the menu item is enabled.</summary>
<value>
<see langword="true" /> if the menu item is enabled; otherwise, <see langword="false" />. The default is <see langword="true" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A <xref:System.Windows.Forms.MenuItem> that is disabled is displayed in a gray color to indicate its state. When a parent menu item is disabled, all submenu items are not displayed.
## Examples
The following code example demonstrates how to use the <xref:System.Windows.Forms.MenuItem.Popup> event to determine whether <xref:System.Windows.Forms.MenuItem> objects that provide support for cut, copy, and delete operations are enabled before the menu they are displayed in is shown. The example determines if `textBox1`, a <xref:System.Windows.Forms.TextBox> control on the form, is enabled, has input focus, and has text selected before enabling the <xref:System.Windows.Forms.MenuItem> objects. This example requires that three <xref:System.Windows.Forms.MenuItem> objects are created named `menuCut`, `menuCopy`, and `menuDelete` have been created.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/MenuItem.Popup/CPP/form1.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/Enabled/form1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/MenuItem.Popup/VB/form1.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Index">
<MemberSignature Language="C#" Value="public int Index { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 Index" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.MenuItem.Index" />
<MemberSignature Language="VB.NET" Value="Public Property Index As Integer" />
<MemberSignature Language="F#" Value="member this.Index : int with get, set" Usage="System.Windows.Forms.MenuItem.Index" />
<MemberSignature Language="C++ CLI" Value="public:
 property int Index { int get(); void set(int value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.Browsable(false)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.Browsable(false)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating the position of the menu item in its parent menu.</summary>
<value>The zero-based index representing the position of the menu item in its parent menu.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property provides the indexed position of a menu item in the menu item collection of its parent menu. You can use this property to reposition a menu item to a different location within its menu. You can also use this property when creating a <xref:System.Windows.Forms.MenuItem> to specify its position in a menu structure at the time of creation.
## Examples
The following code example switches the position of two menu items in a menu. The following code example requires that two <xref:System.Windows.Forms.MenuItem> objects are created named `menuItem1` and `menuItem2`. The `menuItem1` menu item moves down one position in the menu, while `menuItem2` moves up one position.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Index Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/Index/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic MenuItem.Index Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The assigned value is less than zero or greater than the item count.</exception>
</Docs>
</Member>
<Member MemberName="IsParent">
<MemberSignature Language="C#" Value="public override bool IsParent { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool IsParent" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.MenuItem.IsParent" />
<MemberSignature Language="VB.NET" Value="Public Overrides ReadOnly Property IsParent As Boolean" />
<MemberSignature Language="F#" Value="member this.IsParent : bool" Usage="System.Windows.Forms.MenuItem.IsParent" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual property bool IsParent { bool get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.Browsable(false)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.Browsable(false)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the menu item contains child menu items.</summary>
<value>
<see langword="true" /> if the menu item contains child menu items; <see langword="false" /> if the menu is a standalone menu item.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can use this property with the <xref:System.Windows.Forms.MenuItem.Parent%2A> property to navigate in code through an entire menu structure.
## Examples
The following code example determines whether there are any submenus associated with a <xref:System.Windows.Forms.MenuItem> named `menuItem1`. If any submenus exist, it disables them by setting the <xref:System.Windows.Forms.MenuItem.Enabled%2A> property to `false`. The example requires that there is a <xref:System.Windows.Forms.MenuItem> created named `menuItem1`.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.IsParent Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/IsParent/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic MenuItem.IsParent Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="MdiList">
<MemberSignature Language="C#" Value="public bool MdiList { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool MdiList" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.MenuItem.MdiList" />
<MemberSignature Language="VB.NET" Value="Public Property MdiList As Boolean" />
<MemberSignature Language="F#" Value="member this.MdiList : bool with get, set" Usage="System.Windows.Forms.MenuItem.MdiList" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool MdiList { bool get(); void set(bool value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.DefaultValue(false)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.DefaultValue(false)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the menu item will be populated with a list of the Multiple Document Interface (MDI) child windows that are displayed within the associated form.</summary>
<value>
<see langword="true" /> if a list of the MDI child windows is displayed in this menu item; otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When a menu item is selected to display an MDI child window list, the list is displayed as a submenu of the menu item. Only forms that are defined as MDI child forms are displayed in the window list. Only nine child windows can be displayed at a time. If there are more than nine child windows displayed, a "More Windows..." menu item is displayed at the end of the window list. Clicking this menu item displays a dialog box with a complete list of the child windows that are currently active.
## Examples
The following code example creates a <xref:System.Windows.Forms.MenuItem> that is used to display the list of currently open MDI child forms in an MDI form.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MdiList Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/MenuItem/MdiList/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic MenuItem.MdiList Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="MeasureItem">
<MemberSignature Language="C#" Value="public event System.Windows.Forms.MeasureItemEventHandler MeasureItem;" />
<MemberSignature Language="ILAsm" Value=".event class System.Windows.Forms.MeasureItemEventHandler MeasureItem" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.MenuItem.MeasureItem" />
<MemberSignature Language="VB.NET" Value="Public Custom Event MeasureItem As MeasureItemEventHandler " />
<MemberSignature Language="F#" Value="member this.MeasureItem : System.Windows.Forms.MeasureItemEventHandler " Usage="member this.MeasureItem : System.Windows.Forms.MeasureItemEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event System::Windows::Forms::MeasureItemEventHandler ^ MeasureItem;" />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Forms.MeasureItemEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the menu needs to know the size of a menu item before drawing it.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
In order for this event to be raised, you must have the <xref:System.Windows.Forms.MenuItem.OwnerDraw%2A> property of the menu item set to `true`. This event is raised before owner drawn menus are drawn to allow for the size of the menu item to be drawn to be specified. For more information about handling events, see [Handling and Raising Events](/dotnet/standard/events/).
## Examples
The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the <xref:System.Windows.Forms.MenuItem.MeasureItem> event. This report helps you to learn when the event occurs and can assist you in debugging.
To run the example code, paste it into a project that contains an instance of type <xref:System.Windows.Forms.MenuItem> named `MenuItem1`. Then ensure that the event handler is associated with the <xref:System.Windows.Forms.MenuItem.MeasureItem> event.
:::code language="csharp" source="~/snippets/csharp/System.ComponentModel/CollectionChangeEventArgs/Overview/EventExamples.cs" id="Snippet499":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/VB/EventExamples.vb" id="Snippet499":::
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.MenuItem.OwnerDraw" />
<altmember cref="E:System.Windows.Forms.MenuItem.DrawItem" />
</Docs>
</Member>
<Member MemberName="MenuID">
<MemberSignature Language="C#" Value="protected int MenuID { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 MenuID" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.MenuItem.MenuID" />
<MemberSignature Language="VB.NET" Value="Protected ReadOnly Property MenuID As Integer" />
<MemberSignature Language="F#" Value="member this.MenuID : int" Usage="System.Windows.Forms.MenuItem.MenuID" />
<MemberSignature Language="C++ CLI" Value="protected:
 property int MenuID { int get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>