'宣言 Public ReadOnly Property Margins As Infragistics.Win.Margins
public Infragistics.Win.Margins Margins {get;}
Margins オブジェクトの 4 つのプロパティのいずれかに -1 を指定すると、Style に基づくデフォルト値を使用するように UltraExplorerBar に強制します。
UltraExplorerBarStyle が '0 - ExplorerBar' の場合のデフォルト マージンは、15、15、15、15 です。
他のすべての UltraExplorerBarStyle のデフォルト マージンは、0、0、0、0 です。
Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinExplorerBar Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button11.Click ' ------------------------------------------------------------------------------------- ' Set the top and bottom margins of the control to 5, and retain the default margins on ' the left and right. Me.ultraExplorerBar1.Margins.Left = -1 Me.ultraExplorerBar1.Margins.Top = 5 Me.ultraExplorerBar1.Margins.Right = -1 Me.ultraExplorerBar1.Margins.Bottom = 5 ' Display the resolved margin settings. Any margin value set to -1 (the default setting) ' will resolve to a specific default based on the control style. Dim messageText As String = "The resolved margin settings for the control are Left: {0}, Top: {1}, Right: {2}, Bottom: {3}" Dim messageTextFormatted As String = String.Format(messageText, Me.ultraExplorerBar1.MarginsResolved.Left.ToString(), _ Me.ultraExplorerBar1.MarginsResolved.Top.ToString(), _ Me.ultraExplorerBar1.MarginsResolved.Right.ToString(), _ Me.ultraExplorerBar1.MarginsResolved.Bottom.ToString()) Debug.WriteLine(messageTextFormatted) ' ------------------------------------------------------------------------------------- ' Set the left and right margins of the Group item area to 3 on the left and right, and ' retain the default margins on the top and bottom. Make these settings on the control's ' GroupSettings objects which will make them the default settings for the item areas of ' all Groups. We will then override the item area margins for the first group below. Me.ultraExplorerBar1.GroupSettings.ItemAreaMargins.Left = 3 Me.ultraExplorerBar1.GroupSettings.ItemAreaMargins.Top = -1 Me.ultraExplorerBar1.GroupSettings.ItemAreaMargins.Right = 3 Me.ultraExplorerBar1.GroupSettings.ItemAreaMargins.Bottom = -1 ' Display the resolved item area margin settings for all groups. Any margin value set ' to -1 (the default setting) will resolve to a specific default based on the control ' style. messageText = "The resolved item area margin settings for all Groups are Left: {0}, Top: {1}, Right: {2}, Bottom: {3}" messageTextFormatted = String.Format(messageText, Me.ultraExplorerBar1.GroupSettings.ItemAreaMarginsResolved.Left.ToString(), _ Me.ultraExplorerBar1.GroupSettings.ItemAreaMarginsResolved.Top.ToString(), _ Me.ultraExplorerBar1.GroupSettings.ItemAreaMarginsResolved.Right.ToString(), _ Me.ultraExplorerBar1.GroupSettings.ItemAreaMarginsResolved.Bottom.ToString()) Debug.WriteLine(messageTextFormatted) ' Override the item area margin settings for the first Group. If (Me.ultraExplorerBar1.Groups.Count > 0) Then Me.ultraExplorerBar1.Groups(0).Settings.ItemAreaMargins.Left = 7 Me.ultraExplorerBar1.Groups(0).Settings.ItemAreaMargins.Top = 2 Me.ultraExplorerBar1.Groups(0).Settings.ItemAreaMargins.Right = 7 Me.ultraExplorerBar1.Groups(0).Settings.ItemAreaMargins.Bottom = 2 End If End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinExplorerBar; private void button11_Click(object sender, System.EventArgs e) { // ------------------------------------------------------------------------------------- // Set the top and bottom margins of the control to 5, and retain the default margins on // the left and right. this.ultraExplorerBar1.Margins.Left = -1; this.ultraExplorerBar1.Margins.Top = 5; this.ultraExplorerBar1.Margins.Right = -1; this.ultraExplorerBar1.Margins.Bottom = 5; // Display the resolved margin settings. Any margin value set to -1 (the default setting) // will resolve to a specific default based on the control style. string messageText = "The resolved margin settings for the control are Left: {0}, Top: {1}, Right: {2}, Bottom: {3}"; string messageTextFormatted = string.Format(messageText, this.ultraExplorerBar1.MarginsResolved.Left.ToString(), this.ultraExplorerBar1.MarginsResolved.Top.ToString(), this.ultraExplorerBar1.MarginsResolved.Right.ToString(), this.ultraExplorerBar1.MarginsResolved.Bottom.ToString()); Debug.WriteLine(messageTextFormatted); // ------------------------------------------------------------------------------------- // Set the left and right margins of the Group item area to 3 on the left and right, and // retain the default margins on the top and bottom. Make these settings on the control's // GroupSettings objects which will make them the default settings for the item areas of // all Groups. We will then override the item area margins for the first group below. this.ultraExplorerBar1.GroupSettings.ItemAreaMargins.Left = 3; this.ultraExplorerBar1.GroupSettings.ItemAreaMargins.Top = -1; this.ultraExplorerBar1.GroupSettings.ItemAreaMargins.Right = 3; this.ultraExplorerBar1.GroupSettings.ItemAreaMargins.Bottom = -1; // Display the resolved item area margin settings for all groups. Any margin value set // to -1 (the default setting) will resolve to a specific default based on the control // style. messageText = "The resolved item area margin settings for all Groups are Left: {0}, Top: {1}, Right: {2}, Bottom: {3}"; messageTextFormatted = string.Format(messageText, this.ultraExplorerBar1.GroupSettings.ItemAreaMarginsResolved.Left.ToString(), this.ultraExplorerBar1.GroupSettings.ItemAreaMarginsResolved.Top.ToString(), this.ultraExplorerBar1.GroupSettings.ItemAreaMarginsResolved.Right.ToString(), this.ultraExplorerBar1.GroupSettings.ItemAreaMarginsResolved.Bottom.ToString()); Debug.WriteLine(messageTextFormatted); // Override the item area margin settings for the first Group. if (this.ultraExplorerBar1.Groups.Count > 0) { this.ultraExplorerBar1.Groups[0].Settings.ItemAreaMargins.Left = 7; this.ultraExplorerBar1.Groups[0].Settings.ItemAreaMargins.Top = 2; this.ultraExplorerBar1.Groups[0].Settings.ItemAreaMargins.Right = 7; this.ultraExplorerBar1.Groups[0].Settings.ItemAreaMargins.Bottom = 2; } }