unit ToolBarFromMenu;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ToolWin, ComCtrls, Menus;

type
  TForm1 = class(TForm)
    MainMenu1: TMainMenu;
    File1: TMenuItem;
    Exit1: TMenuItem;
    TreeView1: TMenuItem;
    CustomDraw1: TMenuItem;
    Font2: TMenuItem;
    Color2: TMenuItem;
    Drawing1: TMenuItem;
    Font1: TMenuItem;
    Selection1: TMenuItem;
    SelectionBackground1: TMenuItem;
    Background1: TMenuItem;
    Color1: TMenuItem;
    BrushStyle1: TMenuItem;
    Solid1: TMenuItem;
    Clear1: TMenuItem;
    Horizontal1: TMenuItem;
    Vertical1: TMenuItem;
    FDiagonal1: TMenuItem;
    BDiagonal1: TMenuItem;
    Cross1: TMenuItem;
    DiagCross1: TMenuItem;
    Bitmap1: TMenuItem;
    None1: TMenuItem;
    Tile1: TMenuItem;
    Stretch1: TMenuItem;
    N2: TMenuItem;
    DefaultDrawing1: TMenuItem;
    OnCustomDraw1: TMenuItem;
    OnCustomDrawItem1: TMenuItem;
    ButtonColor1: TMenuItem;
    ButtonSize1: TMenuItem;
    ToolBar1: TToolBar;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    ToolButton3: TToolButton;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
// BeginExample: ToolBarFromMenu
// Property: ComCtrls.TToolButton.Grouped
// Property: ComCtrls.TToolButton.MenuItem
// Property: ComCtrls.TToolBar.ShowCaptions
// Property: Forms.TCustomForm.Menu
// BeginCode
{
To create a toolbar that corresponds to an existing menu:

1	Drop a ToolBar on the form and add a ToolButton for each top-level menu item you wish to create.
2	Set the MenuItem property of each ToolButton to correspond to the top level menu items.
3	Set the Grouped property of each ToolButton to true.
4	Clear the Menu property of the Form (if it is assigned)
5	Set the Visible property on the ToolBar and ToolButtons to true.
6	Set the ShowCaptions property on the ToolBar to true.
7	Set the MenuItem | Visible property of each ToolButton to true.
}
// EndCode
// EndExample: ToolBarFromMenu
end.
