'宣言 Public Property AppearanceOnMenu As Infragistics.Win.AppearanceBase
public Infragistics.Win.AppearanceBase AppearanceOnMenu {get; set;}
このプロパティは、PopupMenuTool に配置されるツールのデフォルトの外観を返すか、設定します。AppearanceOnToolbar プロパティは、UltraToolbar に配置されるツールのデフォルトの外観を指定します。
オブジェクトの Appearance プロパティを使用して、外観を決定する Appearance オブジェクトにオブジェクトを関連付けます。Appearanceオブジェクトには、色、境界線、フォント、透明度などの設定を制御するプロパティがあります。UltraWinToolbarsのオブジェクトでは、ほとんどの場合、書式関連のプロパティを直接設定しません。その代わりに Appearance オブジェクトのプロパティを設定することで、その Appearance オブジェクトが関連付けられているオブジェクトの書式設定を制御します。
Appearance オブジェクトのプロパティは、階層式に適用することも可能です。プロパティの中には「use default」値に設定できるものがあります。 これは、オブジェクトの親からプロパティの設定を取得することを意味します。この機能はデフォルトで有効になっているため、設定を変更しないかぎり、子オブジェクトは親に類似し、コントロールの上位階層で設定された書式は下位のオブジェクトに引き継がれます。
Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinToolbars Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button23.Click ' Set the default backcolor and forecolor for all tool appearances. Dim tool As ToolBase For Each tool In Me.UltraToolbarsManager1.Tools tool.SharedProps.AppearancesSmall.Appearance.BackColor = Color.LightBlue tool.SharedProps.AppearancesSmall.Appearance.ForeColor = Color.DarkBlue tool.SharedProps.AppearancesLarge.Appearance.BackColor = Color.LightBlue tool.SharedProps.AppearancesLarge.Appearance.ForeColor = Color.DarkBlue ' NOTE: You can also set defaults for the other appearances off of the ' AppearancesLarge and AppearancesSmall properties, i.e.: ' AppearanceOnMenu ' AppearanceOnToolbar ' HotTrackAppearance ' HotTrackAppearanceOnMenu ' HotTrackAppearanceOnToolbar ' PressedAppearance ' PressedAppearanceOnMenu ' PressedAppearanceOnToolbar Next ' Override the default backcolor and forecolor settings for all instances of the ' tool with the key of 'AlignLeft'. For Each tool In Me.UltraToolbarsManager1.Tools If tool.Key = "AlignLeft" Then Dim toolInstance As ToolBase For Each toolInstance In tool.SharedProps.ToolInstances toolInstance.InstanceProps.AppearancesSmall.Appearance.BackColor = Color.LightGreen toolInstance.InstanceProps.AppearancesSmall.Appearance.ForeColor = Color.DarkGreen toolInstance.InstanceProps.AppearancesLarge.Appearance.BackColor = Color.LightGreen toolInstance.InstanceProps.AppearancesLarge.Appearance.ForeColor = Color.DarkGreen ' NOTE: You can also override defaults for the other appearances off of the ' AppearancesLarge and AppearancesSmall properties, i.e.: ' AppearanceOnMenu ' AppearanceOnToolbar ' HotTrackAppearance ' HotTrackAppearanceOnMenu ' HotTrackAppearanceOnToolbar ' PressedAppearance ' PressedAppearanceOnMenu ' PressedAppearanceOnToolbar Next Exit For End If Next End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinToolbars; private void button23_Click(object sender, System.EventArgs e) { // Set the default backcolor and forecolor for all tool appearances. foreach(ToolBase tool in this.ultraToolbarsManager1.Tools) { tool.SharedProps.AppearancesSmall.Appearance.BackColor = Color.LightBlue; tool.SharedProps.AppearancesSmall.Appearance.ForeColor = Color.DarkBlue; tool.SharedProps.AppearancesLarge.Appearance.BackColor = Color.LightBlue; tool.SharedProps.AppearancesLarge.Appearance.ForeColor = Color.DarkBlue; // NOTE: You can also set defaults for the other appearances off of the // AppearancesLarge and AppearancesSmall properties, i.e.: // AppearanceOnMenu // AppearanceOnToolbar // HotTrackAppearance // HotTrackAppearanceOnMenu // HotTrackAppearanceOnToolbar // PressedAppearance // PressedAppearanceOnMenu // PressedAppearanceOnToolbar } // Override the default backcolor and forecolor settings for all instances of the // tool with the key of 'AlignLeft'. foreach(ToolBase tool in this.ultraToolbarsManager1.Tools) { if (tool.Key == "AlignLeft") { foreach(ToolBase toolInstance in tool.SharedProps.ToolInstances) { toolInstance.InstanceProps.AppearancesSmall.Appearance.BackColor = Color.LightGreen; toolInstance.InstanceProps.AppearancesSmall.Appearance.ForeColor = Color.DarkGreen; toolInstance.InstanceProps.AppearancesLarge.Appearance.BackColor = Color.LightGreen; toolInstance.InstanceProps.AppearancesLarge.Appearance.ForeColor = Color.DarkGreen; // NOTE: You can also override defaults for the other appearances off of the // AppearancesLarge and AppearancesSmall properties, i.e.: // AppearanceOnMenu // AppearanceOnToolbar // HotTrackAppearance // HotTrackAppearanceOnMenu // HotTrackAppearanceOnToolbar // PressedAppearance // PressedAppearanceOnMenu // PressedAppearanceOnToolbar } break; } } }