-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #1281
- Loading branch information
Showing
3 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...m.Windows.Forms.Design.Editors/src/System/Windows/Forms/Design/TabPageCollectionEditor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.ComponentModel.Design; | ||
using System.Diagnostics; | ||
|
||
namespace System.Windows.Forms.Design | ||
{ | ||
/// <summary> | ||
/// Main class for collection editor for <see cref="TabControl.TabPageCollection"/>. | ||
/// Allows a single level of <see cref="ToolStripItem"/> children to be designed. | ||
/// </summary> | ||
internal class TabPageCollectionEditor : CollectionEditor | ||
{ | ||
public TabPageCollectionEditor() : base(typeof(TabControl.TabPageCollection)) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Sets the specified collection to have the specified array of items. | ||
/// </summary> | ||
protected override object SetItems(object editValue, object[] value) | ||
{ | ||
var tabControl = Context.Instance as TabControl; | ||
tabControl?.SuspendLayout(); | ||
|
||
object retValue = base.SetItems(editValue, value); | ||
|
||
tabControl?.ResumeLayout(); | ||
return retValue; | ||
} | ||
|
||
protected override object CreateInstance(Type itemType) | ||
{ | ||
object instance = base.CreateInstance(itemType); | ||
|
||
TabPage tabPage = instance as TabPage; | ||
Debug.Assert(tabPage != null); | ||
tabPage.UseVisualStyleBackColor = true; | ||
|
||
return tabPage; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters