ToolStripDropDownMenu 생성자
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
ToolStripDropDownMenu 클래스의 새 인스턴스를 초기화합니다.
public:
ToolStripDropDownMenu();
public ToolStripDropDownMenu ();
Public Sub New ()
예제
다음 코드 예제에서는 컨트롤을 만들고 초기화하는 ContextMenuStrip 방법을 보여 줍니다. 전체 코드 목록은 방법: ContextMenuStrip 컨트롤에서 여백 및 이미지 여백 검사 사용 방법을 참조하세요.
// This utility method creates a ContextMenuStrip control
// that has four ToolStripMenuItems showing the four
// possible combinations of image and check margins.
internal ContextMenuStrip CreateCheckImageContextMenuStrip()
{
// Create a new ContextMenuStrip control.
ContextMenuStrip checkImageContextMenuStrip = new ContextMenuStrip();
// Create a ToolStripMenuItem with a
// check margin and an image margin.
ToolStripMenuItem yesCheckYesImage =
new ToolStripMenuItem("Check, Image");
yesCheckYesImage.Checked = true;
yesCheckYesImage.Image = CreateSampleBitmap();
// Create a ToolStripMenuItem with no
// check margin and with an image margin.
ToolStripMenuItem noCheckYesImage =
new ToolStripMenuItem("No Check, Image");
noCheckYesImage.Checked = false;
noCheckYesImage.Image = CreateSampleBitmap();
// Create a ToolStripMenuItem with a
// check margin and without an image margin.
ToolStripMenuItem yesCheckNoImage =
new ToolStripMenuItem("Check, No Image");
yesCheckNoImage.Checked = true;
// Create a ToolStripMenuItem with no
// check margin and no image margin.
ToolStripMenuItem noCheckNoImage =
new ToolStripMenuItem("No Check, No Image");
noCheckNoImage.Checked = false;
// Add the ToolStripMenuItems to the ContextMenuStrip control.
checkImageContextMenuStrip.Items.Add(yesCheckYesImage);
checkImageContextMenuStrip.Items.Add(noCheckYesImage);
checkImageContextMenuStrip.Items.Add(yesCheckNoImage);
checkImageContextMenuStrip.Items.Add(noCheckNoImage);
return checkImageContextMenuStrip;
}
' This utility method creates a ContextMenuStrip control
' that has four ToolStripMenuItems showing the four
' possible combinations of image and check margins.
Friend Function CreateCheckImageContextMenuStrip() As ContextMenuStrip
' Create a new ContextMenuStrip control.
Dim checkImageContextMenuStrip As New ContextMenuStrip()
' Create a ToolStripMenuItem with a
' check margin and an image margin.
Dim yesCheckYesImage As New ToolStripMenuItem("Check, Image")
yesCheckYesImage.Checked = True
yesCheckYesImage.Image = CreateSampleBitmap()
' Create a ToolStripMenuItem with no
' check margin and with an image margin.
Dim noCheckYesImage As New ToolStripMenuItem("No Check, Image")
noCheckYesImage.Checked = False
noCheckYesImage.Image = CreateSampleBitmap()
' Create a ToolStripMenuItem with a
' check margin and without an image margin.
Dim yesCheckNoImage As New ToolStripMenuItem("Check, No Image")
yesCheckNoImage.Checked = True
' Create a ToolStripMenuItem with no
' check margin and no image margin.
Dim noCheckNoImage As New ToolStripMenuItem("No Check, No Image")
noCheckNoImage.Checked = False
' Add the ToolStripMenuItems to the ContextMenuStrip control.
checkImageContextMenuStrip.Items.Add(yesCheckYesImage)
checkImageContextMenuStrip.Items.Add(noCheckYesImage)
checkImageContextMenuStrip.Items.Add(yesCheckNoImage)
checkImageContextMenuStrip.Items.Add(noCheckNoImage)
Return checkImageContextMenuStrip
End Function