ToolStripDropDownMenu.ShowCheckMargin 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
ToolStripMenuItem의 왼쪽 가장자리에 확인 표시를 위한 공간이 표시되는지 여부를 나타내는 값을 가져오거나 설정합니다.
public:
property bool ShowCheckMargin { bool get(); void set(bool value); };
public bool ShowCheckMargin { get; set; }
member this.ShowCheckMargin : bool with get, set
Public Property ShowCheckMargin As Boolean
속성 값
선택 여백이 표시되면 true
이고, 그렇지 않으면 false
입니다. 기본값은 false
입니다.
예제
다음 코드 예제에서는 확인 및 이미지 여백을 설정 하 여 컨트롤을 ContextMenuStrip 만들고 초기화하는 방법을 보여 줍니다. 전체 코드 목록은 방법: ContextMenuStrip 컨트롤에서 여백 및 이미지 여백 검사 사용 방법을 참조하세요.
public Form5()
{
// Size the form to show three wide menu items.
this.Width = 500;
this.Text = "ToolStripContextMenuStrip: Image and Check Margins";
// Create a new MenuStrip control.
MenuStrip ms = new MenuStrip();
// Create the ToolStripMenuItems for the MenuStrip control.
ToolStripMenuItem bothMargins = new ToolStripMenuItem("BothMargins");
ToolStripMenuItem imageMarginOnly = new ToolStripMenuItem("ImageMargin");
ToolStripMenuItem checkMarginOnly = new ToolStripMenuItem("CheckMargin");
ToolStripMenuItem noMargins = new ToolStripMenuItem("NoMargins");
// Customize the DropDowns menus.
// This ToolStripMenuItem has an image margin
// and a check margin.
bothMargins.DropDown = CreateCheckImageContextMenuStrip();
((ContextMenuStrip)bothMargins.DropDown).ShowImageMargin = true;
((ContextMenuStrip)bothMargins.DropDown).ShowCheckMargin = true;
// This ToolStripMenuItem has only an image margin.
imageMarginOnly.DropDown = CreateCheckImageContextMenuStrip();
((ContextMenuStrip)imageMarginOnly.DropDown).ShowImageMargin = true;
((ContextMenuStrip)imageMarginOnly.DropDown).ShowCheckMargin = false;
// This ToolStripMenuItem has only a check margin.
checkMarginOnly.DropDown = CreateCheckImageContextMenuStrip();
((ContextMenuStrip)checkMarginOnly.DropDown).ShowImageMargin = false;
((ContextMenuStrip)checkMarginOnly.DropDown).ShowCheckMargin = true;
// This ToolStripMenuItem has no image and no check margin.
noMargins.DropDown = CreateCheckImageContextMenuStrip();
((ContextMenuStrip)noMargins.DropDown).ShowImageMargin = false;
((ContextMenuStrip)noMargins.DropDown).ShowCheckMargin = false;
// Populate the MenuStrip control with the ToolStripMenuItems.
ms.Items.Add(bothMargins);
ms.Items.Add(imageMarginOnly);
ms.Items.Add(checkMarginOnly);
ms.Items.Add(noMargins);
// Dock the MenuStrip control to the top of the form.
ms.Dock = DockStyle.Top;
// Add the MenuStrip control to the controls collection last.
// This is important for correct placement in the z-order.
this.Controls.Add(ms);
}
Public Sub New()
' Size the form to show three wide menu items.
Me.Width = 500
Me.Text = "ToolStripContextMenuStrip: Image and Check Margins"
' Create a new MenuStrip control.
Dim ms As New MenuStrip()
' Create the ToolStripMenuItems for the MenuStrip control.
Dim bothMargins As New ToolStripMenuItem("BothMargins")
Dim imageMarginOnly As New ToolStripMenuItem("ImageMargin")
Dim checkMarginOnly As New ToolStripMenuItem("CheckMargin")
Dim noMargins As New ToolStripMenuItem("NoMargins")
' Customize the DropDowns menus.
' This ToolStripMenuItem has an image margin
' and a check margin.
bothMargins.DropDown = CreateCheckImageContextMenuStrip()
CType(bothMargins.DropDown, ContextMenuStrip).ShowImageMargin = True
CType(bothMargins.DropDown, ContextMenuStrip).ShowCheckMargin = True
' This ToolStripMenuItem has only an image margin.
imageMarginOnly.DropDown = CreateCheckImageContextMenuStrip()
CType(imageMarginOnly.DropDown, ContextMenuStrip).ShowImageMargin = True
CType(imageMarginOnly.DropDown, ContextMenuStrip).ShowCheckMargin = False
' This ToolStripMenuItem has only a check margin.
checkMarginOnly.DropDown = CreateCheckImageContextMenuStrip()
CType(checkMarginOnly.DropDown, ContextMenuStrip).ShowImageMargin = False
CType(checkMarginOnly.DropDown, ContextMenuStrip).ShowCheckMargin = True
' This ToolStripMenuItem has no image and no check margin.
noMargins.DropDown = CreateCheckImageContextMenuStrip()
CType(noMargins.DropDown, ContextMenuStrip).ShowImageMargin = False
CType(noMargins.DropDown, ContextMenuStrip).ShowCheckMargin = False
' Populate the MenuStrip control with the ToolStripMenuItems.
ms.Items.Add(bothMargins)
ms.Items.Add(imageMarginOnly)
ms.Items.Add(checkMarginOnly)
ms.Items.Add(noMargins)
' Dock the MenuStrip control to the top of the form.
ms.Dock = DockStyle.Top
' Add the MenuStrip control to the controls collection last.
' This is important for correct placement in the z-order.
Me.Controls.Add(ms)
End Sub
설명
사용자가 을 ShowCheckMargin 선택할 ToolStripMenuItem때 확인 표시를 표시하도록 true
속성을 설정합니다.