'宣言 Public ReadOnly Property Settings As RibbonTabSettings
public RibbonTabSettings Settings {get;}
Imports Infragistics.Win Imports Infragistics.Win.UltraWinToolBars Private sub SetRibbonTabSettings() ' Add some tabs Dim ribbonTab1 As RibbonTab = New RibbonTab("ribbonTab1", "ribbonTab1") Dim ribbonTab2 As RibbonTab = New RibbonTab("ribbonTab2", "ribbonTab2") Dim ribbonTab3 As RibbonTab = New RibbonTab("ribbonTab3", "ribbonTab3") Me.UltraToolbarsManager1.Ribbon.Tabs.Clear() Me.UltraToolbarsManager1.Ribbon.Tabs.Add(ribbonTab1) Me.UltraToolbarsManager1.Ribbon.Tabs.Add(ribbonTab2) Me.UltraToolbarsManager1.Ribbon.Tabs.Add(ribbonTab3) ' Set some properties on the Ribbon's Tab Settings. These settings will apply to all tabs. Me.UltraToolbarsManager1.Ribbon.TabSettings.Appearance.BackColor = Color.White Me.UltraToolbarsManager1.Ribbon.TabSettings.Appearance.ForeColor = Color.Black Me.UltraToolbarsManager1.Ribbon.TabSettings.TabItemAppearance.BackColor = Color.White Me.UltraToolbarsManager1.Ribbon.TabSettings.TabItemAppearance.ForeColor = Color.Black Me.UltraToolbarsManager1.Ribbon.TabSettings.ClientAreaAppearance.BackColor = Color.White Me.UltraToolbarsManager1.Ribbon.TabSettings.ClientAreaAppearance.ForeColor = Color.Black Me.UltraToolbarsManager1.Ribbon.TabSettings.SelectedAppearance.BackColor = Color.Purple Me.UltraToolbarsManager1.Ribbon.TabSettings.SelectedAppearance.ForeColor = Color.Yellow Me.UltraToolbarsManager1.Ribbon.TabSettings.SelectedAppearance.BackGradientStyle = GradientStyle.None Me.UltraToolbarsManager1.Ribbon.TabSettings.HotTrackSelectedTabItemAppearance.BackColor = Color.Purple Me.UltraToolbarsManager1.Ribbon.TabSettings.HotTrackSelectedTabItemAppearance.ForeColor = Color.Goldenrod Me.UltraToolbarsManager1.Ribbon.TabSettings.HotTrackTabItemAppearance.BackColor = Color.Lavender Me.UltraToolbarsManager1.Ribbon.TabSettings.HotTrackTabItemAppearance.BackGradientStyle = GradientStyle.None ' Set properties on the individual tab items. These will overrides settings on the Ribbon.TabSettings ribbonTab1.Settings.TabItemAppearance.Image = Me.CreateRectangleBitmap(16, 16, Color.Red) ribbonTab2.Settings.TabItemAppearance.Image = Me.CreateRectangleBitmap(16, 16, Color.White) ribbonTab3.Settings.TabItemAppearance.Image = Me.CreateRectangleBitmap(16, 16, Color.Blue) End Sub Private Function CreateRectangleBitmap(ByVal width As Integer, ByVal height As Integer, ByVal color As Color) As Bitmap Dim dummyToolBitmap As Bitmap = New Bitmap(Width, Height) Dim g As Graphics = Graphics.FromImage(dummyToolBitmap) g.Clear(Color) g.DrawRectangle(Pens.Black, 0, 0, Width - 1, Height - 1) g.Dispose() Return dummyToolBitmap End Function
using Infragistics.Win; using Infragistics.Win.UltraWinToolBars; private void SetRibbonTabSettings() { // Add some tabs RibbonTab ribbonTab1 = new RibbonTab("ribbonTab1", "ribbonTab1"); RibbonTab ribbonTab2 = new RibbonTab("ribbonTab2", "ribbonTab2"); RibbonTab ribbonTab3 = new RibbonTab("ribbonTab3", "ribbonTab3"); this.ultraToolbarsManager1.Ribbon.Tabs.Clear(); this.ultraToolbarsManager1.Ribbon.Tabs.Add(ribbonTab1); this.ultraToolbarsManager1.Ribbon.Tabs.Add(ribbonTab2); this.ultraToolbarsManager1.Ribbon.Tabs.Add(ribbonTab3); // Set some properties on the Ribbon's Tab Settings. These settings will apply to all tabs. this.ultraToolbarsManager1.Ribbon.TabSettings.Appearance.BackColor = Color.White; this.ultraToolbarsManager1.Ribbon.TabSettings.Appearance.ForeColor = Color.Black; this.ultraToolbarsManager1.Ribbon.TabSettings.TabItemAppearance.BackColor = Color.White; this.ultraToolbarsManager1.Ribbon.TabSettings.TabItemAppearance.ForeColor = Color.Black; this.ultraToolbarsManager1.Ribbon.TabSettings.ClientAreaAppearance.BackColor = Color.White; this.ultraToolbarsManager1.Ribbon.TabSettings.ClientAreaAppearance.ForeColor = Color.Black; this.ultraToolbarsManager1.Ribbon.TabSettings.SelectedAppearance.BackColor = Color.Purple; this.ultraToolbarsManager1.Ribbon.TabSettings.SelectedAppearance.ForeColor = Color.Yellow; this.ultraToolbarsManager1.Ribbon.TabSettings.SelectedAppearance.BackGradientStyle = GradientStyle.None; this.ultraToolbarsManager1.Ribbon.TabSettings.HotTrackSelectedTabItemAppearance.BackColor = Color.Purple; this.ultraToolbarsManager1.Ribbon.TabSettings.HotTrackSelectedTabItemAppearance.ForeColor = Color.Goldenrod; this.ultraToolbarsManager1.Ribbon.TabSettings.HotTrackTabItemAppearance.BackColor = Color.Lavender; this.ultraToolbarsManager1.Ribbon.TabSettings.HotTrackTabItemAppearance.BackGradientStyle = GradientStyle.None; // Set properties on the individual tab items. These will override settings on the Ribbon.TabSettings ribbonTab1.Settings.TabItemAppearance.Image = this.CreateRectangleBitmap(16,16, Color.Red); ribbonTab2.Settings.TabItemAppearance.Image = this.CreateRectangleBitmap(16, 16, Color.White); ribbonTab3.Settings.TabItemAppearance.Image = this.CreateRectangleBitmap(16, 16, Color.Blue); } private Bitmap CreateRectangleBitmap(int width, int height, Color color) { Bitmap dummyToolBitmap = new Bitmap(width, height); Graphics g = Graphics.FromImage(dummyToolBitmap); g.Clear(color); g.DrawRectangle(Pens.Black, 0, 0, width-1, height-1); g.Dispose(); return dummyToolBitmap; }