'宣言 Public Class ToolbarSettings Inherits ToolbarSettingsBase
public class ToolbarSettings : ToolbarSettingsBase
Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinToolbars Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click ' ---------------------------------------------------------------------------- ' ツールバーを 3 つ作成し、UltraToolbarManager のツールバー コレクションに追加します Me.UltraToolbarsManager1.Toolbars.AddToolbarRange(New String() {"MyToolbar3", "MyToolbar4", "MyToolbar5"}) ' ---------------------------------------------------------------------------- ' ボタン ツールを作成し、'MyToolbar3' および 'MyToolbar4' に追加します Dim testButtonTool1 As New ButtonTool("TestButton1") Dim testButtonTool2 As New ButtonTool("TestButton2") Dim testButtonTool3 As New ButtonTool("TestButton3") Dim testButtonTool4 As New ButtonTool("TestButton4") ' ツールのプロパティを設定します testButtonTool1.SharedProps.Caption = "TestButton 1" testButtonTool1.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Hand.Handle) testButtonTool2.SharedProps.Caption = "TestButton 2" testButtonTool2.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Application.Handle) testButtonTool3.SharedProps.Caption = "TestButton 3" testButtonTool3.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Question.Handle) testButtonTool4.SharedProps.Caption = "TestButton 4" testButtonTool4.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.WinLogo.Handle) ' メニューまたはツールバーに追加する前に、常に新しいツールを ' UltraToolbarManager のルート ツール コレクションに追加します Me.UltraToolbarsManager1.Tools.AddRange(New ToolBase() {testButtonTool1, testButtonTool2, testButtonTool3, testButtonTool4}) ' ツールバーにツールのインスタンスを追加します Me.UltraToolbarsManager1.Toolbars("MyToolbar3").Tools.AddToolRange(New String() {"TestButton1", "TestButton2", "TestButton3", "TestButton4"}) Me.UltraToolbarsManager1.Toolbars("MyToolbar4").Tools.AddToolRange(New String() {"TestButton1", "TestButton2", "TestButton3", "TestButton4"}) Me.UltraToolbarsManager1.Toolbars("MyToolbar5").Tools.AddToolRange(New String() {"TestButton1", "TestButton2", "TestButton3", "TestButton4"}) ' ---------------------------------------------------------------------------- ' UltraToolbarsManager の ToolbarSettings プロパティにアクセスし、 ' すべてのツールバーのデフォルト設定を変更します Me.UltraToolbarsManager1.ToolbarSettings.AllowCustomize = DefaultableBoolean.True Me.UltraToolbarsManager1.ToolbarSettings.AllowDockBottom = DefaultableBoolean.True Me.UltraToolbarsManager1.ToolbarSettings.AllowDockLeft = DefaultableBoolean.False Me.UltraToolbarsManager1.ToolbarSettings.AllowDockRight = DefaultableBoolean.True Me.UltraToolbarsManager1.ToolbarSettings.AllowDockTop = DefaultableBoolean.False Me.UltraToolbarsManager1.ToolbarSettings.AllowFloating = DefaultableBoolean.False Me.UltraToolbarsManager1.ToolbarSettings.AllowHiding = DefaultableBoolean.False Me.UltraToolbarsManager1.ToolbarSettings.Appearance.BackColor = Color.Blue Me.UltraToolbarsManager1.ToolbarSettings.Appearance.ForeColor = Color.Cyan Me.UltraToolbarsManager1.ToolbarSettings.BorderStyleDocked = UIElementBorderStyle.Dotted Me.UltraToolbarsManager1.ToolbarSettings.CaptionPlacement = TextPlacement.BelowImage Me.UltraToolbarsManager1.ToolbarSettings.DockedAppearance.BackColor = Color.Silver Me.UltraToolbarsManager1.ToolbarSettings.EditAppearance.BackColor = Color.Red Me.UltraToolbarsManager1.ToolbarSettings.FillEntireRow = DefaultableBoolean.False Me.UltraToolbarsManager1.ToolbarSettings.FloatingAppearance.BackColor = Color.Blue Me.UltraToolbarsManager1.ToolbarSettings.GrabHandleStyle = GrabHandleStyle.Office2000 Me.UltraToolbarsManager1.ToolbarSettings.HotTrackAppearance.BackColor = Color.Red Me.UltraToolbarsManager1.ToolbarSettings.PaddingBottom = 3 Me.UltraToolbarsManager1.ToolbarSettings.PaddingLeft = 3 Me.UltraToolbarsManager1.ToolbarSettings.PaddingRight = 3 Me.UltraToolbarsManager1.ToolbarSettings.PaddingTop = 3 Me.UltraToolbarsManager1.ToolbarSettings.PressedAppearance.BackColor = Color.CadetBlue Me.UltraToolbarsManager1.ToolbarSettings.ToolAppearance.BackColor = Color.Transparent Me.UltraToolbarsManager1.ToolbarSettings.ToolDisplayStyle = ToolDisplayStyle.ImageAndText Me.UltraToolbarsManager1.ToolbarSettings.ToolSpacing = 3 ' ---------------------------------------------------------------------------- ' 'MyToolbar4' の Settings プロパティにアクセスし、 ' 'MyToolbar4' のみの設定をオーバーライドします'MyToolbar4' のみを影響します Me.UltraToolbarsManager1.Toolbars("MyToolbar4").Settings.Appearance.BackColor = Color.Red Me.UltraToolbarsManager1.Toolbars("MyToolbar4").Settings.Appearance.ForeColor = Color.Pink Me.UltraToolbarsManager1.Toolbars("MyToolbar4").Settings.AllowFloating = DefaultableBoolean.True Me.UltraToolbarsManager1.Toolbars("MyToolbar4").Settings.ToolSpacing = 15 Me.UltraToolbarsManager1.Toolbars("MyToolbar4").Settings.ToolAppearance.FontData.Bold = DefaultableBoolean.True Me.UltraToolbarsManager1.Toolbars("MyToolbar4").Settings.ToolAppearance.FontData.Italic = DefaultableBoolean.True End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinToolbars; private void button4_Click(object sender, System.EventArgs e) { // ---------------------------------------------------------------------------- // ツールバーを3 つ作成し、UltraToolbarManager のツールバー コレクションに追加します this.ultraToolbarsManager1.Toolbars.AddToolbarRange(new string [] {"MyToolbar3", "MyToolbar4", "MyToolbar5"} ); // ---------------------------------------------------------------------------- // ボタン ツールを作成し、'MyToolbar3' および 'MyToolbar4' に追加します ButtonTool testButtonTool1 = new ButtonTool("TestButton1"); ButtonTool testButtonTool2 = new ButtonTool("TestButton2"); ButtonTool testButtonTool3 = new ButtonTool("TestButton3"); ButtonTool testButtonTool4 = new ButtonTool("TestButton4"); // ツールのプロパティを設定します testButtonTool1.SharedProps.Caption = "TestButton 1"; testButtonTool1.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Hand.Handle); testButtonTool2.SharedProps.Caption = "TestButton 2"; testButtonTool2.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Application.Handle); testButtonTool3.SharedProps.Caption = "TestButton 3"; testButtonTool3.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Question.Handle); testButtonTool4.SharedProps.Caption = "TestButton 4"; testButtonTool4.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.WinLogo.Handle); // メニューまたはツールバーに追加する前に、常に新しいツールを // UltraToolbarManager のルート ツール コレクションに追加します this.ultraToolbarsManager1.Tools.AddRange(new ToolBase [] {testButtonTool1, testButtonTool2, testButtonTool3, testButtonTool4} ); // ツールバーにツールのインスタンスを追加します this.ultraToolbarsManager1.Toolbars["MyToolbar3"].Tools.AddToolRange( new string [] {"TestButton1", "TestButton2", "TestButton3", "TestButton4"} ); this.ultraToolbarsManager1.Toolbars["MyToolbar4"].Tools.AddToolRange( new string [] {"TestButton1", "TestButton2", "TestButton3", "TestButton4"} ); this.ultraToolbarsManager1.Toolbars["MyToolbar5"].Tools.AddToolRange( new string [] {"TestButton1", "TestButton2", "TestButton3", "TestButton4"} ); // ---------------------------------------------------------------------------- // UltraToolbarsManager の ToolbarSettings プロパティにアクセスし、 // すべてのツールバーのデフォルト設定を変更します this.ultraToolbarsManager1.ToolbarSettings.AllowCustomize = DefaultableBoolean.True; this.ultraToolbarsManager1.ToolbarSettings.AllowDockBottom = DefaultableBoolean.True; this.ultraToolbarsManager1.ToolbarSettings.AllowDockLeft = DefaultableBoolean.False; this.ultraToolbarsManager1.ToolbarSettings.AllowDockRight = DefaultableBoolean.True; this.ultraToolbarsManager1.ToolbarSettings.AllowDockTop = DefaultableBoolean.False; this.ultraToolbarsManager1.ToolbarSettings.AllowFloating = DefaultableBoolean.False; this.ultraToolbarsManager1.ToolbarSettings.AllowHiding = DefaultableBoolean.False; this.ultraToolbarsManager1.ToolbarSettings.Appearance.BackColor = Color.Blue; this.ultraToolbarsManager1.ToolbarSettings.Appearance.ForeColor = Color.Cyan; this.ultraToolbarsManager1.ToolbarSettings.BorderStyleDocked = UIElementBorderStyle.Dotted; this.ultraToolbarsManager1.ToolbarSettings.CaptionPlacement = TextPlacement.BelowImage; this.ultraToolbarsManager1.ToolbarSettings.DockedAppearance.BackColor = Color.Silver; this.ultraToolbarsManager1.ToolbarSettings.EditAppearance.BackColor = Color.Red; this.ultraToolbarsManager1.ToolbarSettings.FillEntireRow = DefaultableBoolean.False; this.ultraToolbarsManager1.ToolbarSettings.FloatingAppearance.BackColor = Color.Blue; this.ultraToolbarsManager1.ToolbarSettings.GrabHandleStyle = GrabHandleStyle.Office2000; this.ultraToolbarsManager1.ToolbarSettings.HotTrackAppearance.BackColor = Color.Red; this.ultraToolbarsManager1.ToolbarSettings.PaddingBottom = 3; this.ultraToolbarsManager1.ToolbarSettings.PaddingLeft = 3; this.ultraToolbarsManager1.ToolbarSettings.PaddingRight = 3; this.ultraToolbarsManager1.ToolbarSettings.PaddingTop = 3; this.ultraToolbarsManager1.ToolbarSettings.PressedAppearance.BackColor = Color.CadetBlue; this.ultraToolbarsManager1.ToolbarSettings.ToolAppearance.BackColor = Color.Transparent; this.ultraToolbarsManager1.ToolbarSettings.ToolDisplayStyle = ToolDisplayStyle.ImageAndText; this.ultraToolbarsManager1.ToolbarSettings.ToolSpacing = 3; // ---------------------------------------------------------------------------- // 'MyToolbar4' の Settings プロパティにアクセスし、 // 'MyToolbar4' の設定のみオーバーライドします'MyToolbar4' のみに影響します this.ultraToolbarsManager1.Toolbars["MyToolbar4"].Settings.Appearance.BackColor = Color.Red; this.ultraToolbarsManager1.Toolbars["MyToolbar4"].Settings.Appearance.ForeColor = Color.Pink; this.ultraToolbarsManager1.Toolbars["MyToolbar4"].Settings.AllowFloating = DefaultableBoolean.True; this.ultraToolbarsManager1.Toolbars["MyToolbar4"].Settings.ToolSpacing = 15; this.ultraToolbarsManager1.Toolbars["MyToolbar4"].Settings.ToolAppearance.FontData.Bold = DefaultableBoolean.True; this.ultraToolbarsManager1.Toolbars["MyToolbar4"].Settings.ToolAppearance.FontData.Italic = DefaultableBoolean.True; }