ToolStripManager.RevertMerge 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
두 ToolStrip 개체의 병합을 실행 취소합니다.
오버로드
RevertMerge(String) |
두 ToolStrip 개체의 병합을 실행 취소합니다. 지정된 이름의 ToolStrip을 병합 이전의 상태로 되돌리고 이전의 병합 작업을 모두 취소합니다. |
RevertMerge(ToolStrip) |
두 ToolStrip 개체의 병합을 실행 취소합니다. 지정된 ToolStrip을 병합 이전의 상태로 되돌리고 이전의 병합 작업을 모두 취소합니다. |
RevertMerge(ToolStrip, ToolStrip) |
두 ToolStrip 개체의 병합을 실행 취소합니다. 두 ToolStrip 컨트롤을 모두 병합 이전의 상태로 되돌리고 이전의 병합 작업을 모두 취소합니다. |
RevertMerge(String)
public:
static bool RevertMerge(System::String ^ targetName);
public static bool RevertMerge (string targetName);
static member RevertMerge : string -> bool
Public Shared Function RevertMerge (targetName As String) As Boolean
매개 변수
- targetName
- String
병합 작업을 실행 취소할 ToolStripItem의 이름입니다.
반환
병합 작업의 실행 취소가 성공적으로 수행되면 true
이고, 그렇지 않으면 false
입니다.
설명
합니다 ToolStrip.AllowMerge 속성으로 설정 되어 있어야 true
둘 다에 대해 ToolStrip 개체 또는이 메서드에서 반환 false
합니다.
추가 정보
적용 대상
RevertMerge(ToolStrip)
public:
static bool RevertMerge(System::Windows::Forms::ToolStrip ^ targetToolStrip);
public static bool RevertMerge (System.Windows.Forms.ToolStrip targetToolStrip);
static member RevertMerge : System.Windows.Forms.ToolStrip -> bool
Public Shared Function RevertMerge (targetToolStrip As ToolStrip) As Boolean
매개 변수
- targetToolStrip
- ToolStrip
병합 작업을 실행 취소할 ToolStripItem입니다.
반환
병합 작업의 실행 취소가 성공적으로 수행되면 true
이고, 그렇지 않으면 false
입니다.
예제
다음 코드 예제에서는 메뉴 항목의 병합을 실행 취소 합니다. 이 예제는에서 사용할 수 있는 보다 큰 예제의 일부는 ToolStripManager 클래스 개요입니다.
private MergeSample CurrentSample
{
get { return currentSample; }
set
{
if (currentSample != value)
{
bool resetRequired = false;
if (currentSample == MergeSample.MatchOnly)
{
resetRequired = true;
}
currentSample = value;
// Undo previous merge, if any.
ToolStripManager.RevertMerge(cmsBase, cmsItemsToMerge);
if (resetRequired)
{
RebuildItemsToMerge();
}
switch (currentSample)
{
case MergeSample.None:
return;
case MergeSample.Append:
ScenarioText = "This sample adds items to the end of the list using MergeAction.Append.\r\n\r\nThis is the default setting for MergeAction. A typical scenario is adding menu items to the end of the menu when some part of the program is activated.";
ShowAppendSample();
break;
case MergeSample.InsertInSameLocation:
ScenarioText = "This sample adds items to the middle of the list using MergeAction.Insert.\r\n\r\nNotice here how the items are added in reverse order: four, three, two, one. This is because they all have the same merge index.\r\n\r\nA typical scenario is adding menu items to the middle or beginning of the menu when some part of the program is activated. ";
ShowInsertInSameLocationSample();
break;
case MergeSample.InsertInSameLocationPreservingOrder:
ScenarioText = "This sample is the same as InsertInSameLocation, except the items are added in normal order by increasing the MergeIndex of \"two merged items\" to be 3, \"three merged items\" to be 5, and so on.\r\n You could also add the original items backwards to the source ContextMenuStrip.";
ShowInsertInSameLocationPreservingOrderSample();
break;
case MergeSample.ReplacingItems:
ScenarioText = "This sample replaces a menu item using MergeAction.Replace. Use this for the MDI scenario where saving does something completely different.\r\n\r\nMatching is based on the Text property. If there is no text match, merging reverts to MergeIndex.";
ShowReplaceSample();
break;
case MergeSample.MatchOnly:
ScenarioText = "This sample adds only the subitems from the child to the target ContextMenuStrip.";
ShowMatchOnlySample();
break;
}
// Reapply with the new settings.
ToolStripManager.Merge(cmsItemsToMerge, cmsBase);
}
}
}
Private Property CurrentSample() As MergeSample
Get
Return currentSample1
End Get
Set
If currentSample1 <> value Then
Dim resetRequired As Boolean = False
If currentSample1 = MergeSample.MatchOnly Then
resetRequired = True
End If
currentSample1 = value
' Undo previous merge, if any.
ToolStripManager.RevertMerge(cmsBase, cmsItemsToMerge)
If resetRequired Then
RebuildItemsToMerge()
End If
Select Case currentSample1
Case MergeSample.None
Return
Case MergeSample.Append
ScenarioText = "This sample adds items to the end of the list using MergeAction.Append." + ControlChars.Cr + ControlChars.Lf + ControlChars.Cr + ControlChars.Lf + "This is the default setting for MergeAction. A typical scenario is adding menu items to the end of the menu when some part of the program is activated."
ShowAppendSample()
Case MergeSample.InsertInSameLocation
ScenarioText = "This sample adds items to the middle of the list using MergeAction.Insert." + ControlChars.Cr + ControlChars.Lf + ControlChars.Cr + ControlChars.Lf + "Notice here how the items are added in reverse order: four, three, two, one. This is because they all have the same merge index." + ControlChars.Cr + ControlChars.Lf + ControlChars.Cr + ControlChars.Lf + "A typical scenario is adding menu items to the middle or beginning of the menu when some part of the program is activated. "
ShowInsertInSameLocationSample()
Case MergeSample.InsertInSameLocationPreservingOrder
ScenarioText = "This sample is the same as InsertInSameLocation, except the items are added in normal order by increasing the MergeIndex of ""two merged items"" to be 3, ""three merged items"" to be 5, and so on." + ControlChars.Cr + ControlChars.Lf + " You could also add the original items backwards to the source ContextMenuStrip."
ShowInsertInSameLocationPreservingOrderSample()
Case MergeSample.ReplacingItems
ScenarioText = "This sample replaces a menu item using MergeAction.Replace. Use this for the MDI scenario where saving does something completely different." + ControlChars.Cr + ControlChars.Lf + ControlChars.Cr + ControlChars.Lf + "Matching is based on the Text property. If there is no text match, merging reverts to MergeIndex."
ShowReplaceSample()
Case MergeSample.MatchOnly
ScenarioText = "This sample adds only the subitems from the child to the target ContextMenuStrip."
ShowMatchOnlySample()
End Select
' Reapply with the new settings.
ToolStripManager.Merge(cmsItemsToMerge, cmsBase)
End If
End Set
End Property
설명
합니다 ToolStrip.AllowMerge 속성으로 설정 되어 있어야 true
둘 다에 대해 ToolStrip 개체 또는이 메서드에서 반환 false
합니다.
추가 정보
적용 대상
RevertMerge(ToolStrip, ToolStrip)
public:
static bool RevertMerge(System::Windows::Forms::ToolStrip ^ targetToolStrip, System::Windows::Forms::ToolStrip ^ sourceToolStrip);
public static bool RevertMerge (System.Windows.Forms.ToolStrip targetToolStrip, System.Windows.Forms.ToolStrip sourceToolStrip);
static member RevertMerge : System.Windows.Forms.ToolStrip * System.Windows.Forms.ToolStrip -> bool
Public Shared Function RevertMerge (targetToolStrip As ToolStrip, sourceToolStrip As ToolStrip) As Boolean
매개 변수
- targetToolStrip
- ToolStrip
병합 작업을 실행 취소할 ToolStripItem의 이름입니다.
반환
병합 작업의 실행 취소가 성공적으로 수행되면 true
이고, 그렇지 않으면 false
입니다.
예외
sourceToolStrip
이 null
인 경우
설명
합니다 ToolStrip.AllowMerge 속성으로 설정 되어 있어야 true
둘 다에 대해 ToolStrip 개체 또는이 메서드에서 반환 false
합니다.