Imports Infragistics.Win Imports Infragistics.Win.UltraWinToolBars private sub SetUpQAT() Me.UltraToolbarsManager1.Ribbon.QuickAccessToolbar.Visible = True Me.UltraToolbarsManager1.Ribbon.QuickAccessToolbar.Location = QuickAccessToolbarLocation.AboveRibbon ' Create tools Me.UltraToolbarsManager1.Tools.Add(New PopupMenuTool("Paste")) Me.UltraToolbarsManager1.Tools.Add(New ButtonTool("Cut")) Me.UltraToolbarsManager1.Tools.Add(New ButtonTool("Copy")) ' Create some dummy images which will be used for every tool for the purposes of this ' sample code Dim toolImageSmall As Bitmap = Me.CreateRectangleBitmap(16, 16, Color.Blue) ' Add the tools into the QAT. ' Paste Tool Dim toolPaste As PopupMenuTool = DirectCast(Me.UltraToolbarsManager1.Ribbon.QuickAccessToolbar.Tools.AddTool("Paste"), PopupMenuTool) toolPaste.SharedProps.Caption = toolPaste.Key toolPaste.SharedProps.AppearancesSmall.Appearance.Image = toolImageSmall toolPaste.DropDownArrowStyle = DropDownArrowStyle.Segmented ' Cut Dim toolCut As ButtonTool = DirectCast(Me.UltraToolbarsManager1.Ribbon.QuickAccessToolbar.Tools.AddTool("Cut"), ButtonTool) toolCut.SharedProps.Caption = toolCut.Key toolCut.SharedProps.AppearancesSmall.Appearance.Image = toolImageSmall ' Copy Dim toolCopy As ButtonTool = DirectCast(Me.UltraToolbarsManager1.Ribbon.QuickAccessToolbar.Tools.AddTool("Copy"), ButtonTool) toolCopy.SharedProps.Caption = toolCopy.Key toolCopy.SharedProps.AppearancesSmall.Appearance.Image = toolImageSmall 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 SetUpQAT() { this.ultraToolbarsManager1.Ribbon.QuickAccessToolbar.Visible = true; this.ultraToolbarsManager1.Ribbon.QuickAccessToolbar.Location = QuickAccessToolbarLocation.AboveRibbon; // Create tools this.ultraToolbarsManager1.Tools.Add(new PopupMenuTool("Paste")); this.ultraToolbarsManager1.Tools.Add(new ButtonTool("Cut")); this.ultraToolbarsManager1.Tools.Add(new ButtonTool("Copy")); // Create some dummy images which will be used for every tool for the purposes of this // sample code Bitmap toolImageSmall = this.CreateRectangleBitmap(16, 16, Color.Blue); // Add the tools into the QAT. // Paste Tool PopupMenuTool toolPaste = this.ultraToolbarsManager1.Ribbon.QuickAccessToolbar.Tools.AddTool("Paste") as PopupMenuTool; toolPaste.SharedProps.Caption = toolPaste.Key; toolPaste.SharedProps.AppearancesSmall.Appearance.Image = toolImageSmall; toolPaste.DropDownArrowStyle = DropDownArrowStyle.Segmented; // Cut ButtonTool toolCut = this.ultraToolbarsManager1.Ribbon.QuickAccessToolbar.Tools.AddTool("Cut") as ButtonTool; toolCut.SharedProps.Caption = toolCut.Key; toolCut.SharedProps.AppearancesSmall.Appearance.Image = toolImageSmall; // Copy ButtonTool toolCopy = this.ultraToolbarsManager1.Ribbon.QuickAccessToolbar.Tools.AddTool("Copy") as ButtonTool; toolCopy.SharedProps.Caption = toolCopy.Key; toolCopy.SharedProps.AppearancesSmall.Appearance.Image = toolImageSmall; } 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; }