バージョン

Tools プロパティ (RibbonGroup)

グループ内に含まれるツールのコレクションを返します。
シンタックス
'宣言
 
Public ReadOnly Property Tools As ToolsCollection
public ToolsCollection Tools {get;}
使用例
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinToolBars

private sub SetRibbonGroupProperties()

	' Add a RibbonTab
	Dim ribbonTab As RibbonTab = Me.UltraToolbarsManager1.Ribbon.Tabs.Add("Ribbon Tab Key")
	ribbonTab.Caption = "Ribbon Group Caption"

	' Add some groups
	Dim ribbonGroupClipboard As RibbonGroup = ribbonTab.Groups.Add("Clipboard")
	ribbonGroupClipboard.Caption = "Clipboard"

	' Create tools
	Me.UltraToolbarsManager1.Tools.Add(New PopupMenuTool("Paste"))
	Me.UltraToolbarsManager1.Tools.Add(New ButtonTool("Cut"))
	Me.UltraToolbarsManager1.Tools.Add(New ButtonTool("Copy"))
	Me.UltraToolbarsManager1.Tools.Add(New ButtonTool("Format Painter"))
	Me.UltraToolbarsManager1.Tools.Add(New ButtonTool("ClipboardDialogBoxLauncher"))

	' Create some dummy images which will be used for every tool for the purposes of this
	' sample code
	Dim toolImageSmall As Bitmap = Me.CreateDummyToolBitmap(16, 16, Color.Blue)
	Dim toolImageLarge As Bitmap = Me.CreateDummyToolBitmap(32, 32, Color.Green)

	' Add the tools into the appropriate groups and arrange them.

	' Paste Tool
	Dim toolPaste As PopupMenuTool = DirectCast(ribbonGroupClipboard.Tools.AddTool("Paste"), PopupMenuTool)
	toolPaste.SharedProps.Caption = toolPaste.Key
	toolPaste.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large
	toolPaste.SharedProps.AppearancesLarge.Appearance.Image = toolImageLarge
	toolPaste.DropDownArrowStyle = DropDownArrowStyle.Segmented

	' Cut
	Dim toolCut As ButtonTool = DirectCast(ribbonGroupClipboard.Tools.AddTool("Cut"), ButtonTool)
	toolCut.SharedProps.Caption = toolCut.Key
	toolCut.SharedProps.AppearancesSmall.Appearance.Image = toolImageSmall

	' Copy
	Dim toolCopy As ButtonTool = DirectCast(ribbonGroupClipboard.Tools.AddTool("Copy"), ButtonTool)
	toolCopy.SharedProps.Caption = toolCopy.Key
	toolCopy.SharedProps.AppearancesSmall.Appearance.Image = toolImageSmall

	' Format Painter
	Dim toolFormatPainter As ButtonTool = DirectCast(ribbonGroupClipboard.Tools.AddTool("Format Painter"), ButtonTool)
	toolFormatPainter.SharedProps.Caption = toolFormatPainter.Key
	toolFormatPainter.SharedProps.AppearancesSmall.Appearance.Image = toolImageSmall

	' Set up DialogBoxLauncher tools for each of the groups. 
	ribbonGroupClipboard.DialogBoxLauncherKey = "ClipboardDialogBoxLauncher"

	' Set the KeyTip
	ribbonGroupClipboard.KeyTip = "C"

	' Set the LayoutAlignment
	ribbonGroupClipboard.LayoutAlignment = RibbonGroupLayoutAlignment.Center

	' Set the LayoutDirection
	ribbonGroupClipboard.LayoutDirection = RibbonGroupToolLayoutDirection.Vertical

	' Set the PreferredToolSize
	ribbonGroupClipboard.PreferredToolSize = RibbonToolSize.Normal

	' Make the group visible
	ribbonGroupClipboard.Visible = True

End Sub

Private Function CreateDummyToolBitmap(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 SetRibbonGroupProperties()
{
	// Add a RibbonTab	
	RibbonTab ribbonTab = this.ultraToolbarsManager1.Ribbon.Tabs.Add("Ribbon Tab Key");
	ribbonTab.Caption = "Ribbon Group Caption";

	// Add some groups
	RibbonGroup ribbonGroupClipboard = ribbonTab.Groups.Add("Clipboard");
	ribbonGroupClipboard.Caption = "Clipboard";

	// Create tools
	this.ultraToolbarsManager1.Tools.Add(new PopupMenuTool("Paste"));
	this.ultraToolbarsManager1.Tools.Add(new ButtonTool("Cut"));
	this.ultraToolbarsManager1.Tools.Add(new ButtonTool("Copy"));
	this.ultraToolbarsManager1.Tools.Add(new ButtonTool("Format Painter"));
	this.ultraToolbarsManager1.Tools.Add(new ButtonTool("ClipboardDialogBoxLauncher"));

	// Create some dummy images which will be used for every tool for the purposes of this
	// sample code
	Bitmap toolImageSmall = this.CreateDummyToolBitmap(16, 16, Color.Blue);
	Bitmap toolImageLarge = this.CreateDummyToolBitmap(32, 32, Color.Green);

	// Add the tools into the appropriate groups and arrange them.

	// Paste Tool
	PopupMenuTool toolPaste = ribbonGroupClipboard.Tools.AddTool("Paste") as PopupMenuTool;
	toolPaste.SharedProps.Caption = toolPaste.Key;
	toolPaste.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large;
	toolPaste.SharedProps.AppearancesLarge.Appearance.Image = toolImageLarge;
	toolPaste.DropDownArrowStyle = DropDownArrowStyle.Segmented;

	// Cut
	ButtonTool toolCut = ribbonGroupClipboard.Tools.AddTool("Cut") as ButtonTool;
	toolCut.SharedProps.Caption = toolCut.Key;
	toolCut.SharedProps.AppearancesSmall.Appearance.Image = toolImageSmall;

	// Copy
	ButtonTool toolCopy = ribbonGroupClipboard.Tools.AddTool("Copy") as ButtonTool;
	toolCopy.SharedProps.Caption = toolCopy.Key;
	toolCopy.SharedProps.AppearancesSmall.Appearance.Image = toolImageSmall;

	// Format Painter
	ButtonTool toolFormatPainter = ribbonGroupClipboard.Tools.AddTool("Format Painter") as ButtonTool;
	toolFormatPainter.SharedProps.Caption = toolFormatPainter.Key;
	toolFormatPainter.SharedProps.AppearancesSmall.Appearance.Image = toolImageSmall;           

	// Set up DialogBoxLauncher tools for each of the groups. 
	ribbonGroupClipboard.DialogBoxLauncherKey = "ClipboardDialogBoxLauncher";

	// Set the KeyTip
	ribbonGroupClipboard.KeyTip = "C";

	// Set the LayoutAlignment
	ribbonGroupClipboard.LayoutAlignment = RibbonGroupLayoutAlignment.Center;

	// Set the LayoutDirection
	ribbonGroupClipboard.LayoutDirection = RibbonGroupToolLayoutDirection.Vertical;

	// Set the PreferredToolSize
	ribbonGroupClipboard.PreferredToolSize = RibbonToolSize.Normal;

	// Make the group visible
	ribbonGroupClipboard.Visible = true;
}

private Bitmap CreateDummyToolBitmap(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;
}
参照