Overview

BeepToolStrip is a customizable tool strip control designed for Beep WinForms applications. It supports theming, icon integration, and flexible layout for tool buttons, dropdowns, and separators, providing quick access to commonly used application functions.

Built on the BeepControl foundation, BeepToolStrip features automatic button sizing, overflow handling, icon management, theme integration, and support for various item types including buttons, dropdowns, and separators. Perfect for application toolbars, quick access panels, and professional interface components.

Key Features

🎨 Modern Styling

Theme-aware design with modern look and feel

🔧 Flexible Items

Support for buttons, dropdowns, separators, and custom controls

🖼️ Icon Integration

Customizable icons with tooltips and automatic sizing

📱 Responsive Layout

Automatic overflow handling and responsive sizing

🔗 Easy Integration

Seamless integration with BeepMenuBar and BeepAppBar

⚡ Performance

Optimized rendering and efficient event handling

Visual Preview

💾
Save
📁
Open
📋
Copy
📄
Paste
🔍
Search

BeepToolStrip with various tool items including separators and dropdown

Basic Usage

Simple Tool Strip

// Create and configure a BeepToolStrip
var toolStrip = new BeepToolStrip();
toolStrip.Theme = "Dark";
toolStrip.Dock = DockStyle.Top;

// Add buttons
var saveButton = new BeepToolStripButton
{
    Text = "Save",
    Icon = Properties.Resources.SaveIcon,
    ToolTipText = "Save changes"
};
saveButton.Click += (s, e) => SaveData();
toolStrip.Items.Add(saveButton);

var openButton = new BeepToolStripButton
{
    Text = "Open",
    Icon = Properties.Resources.OpenIcon,
    ToolTipText = "Open file"
};
toolStrip.Items.Add(openButton);

// Add to form
this.Controls.Add(toolStrip);

Tool Strip with Separators

var toolStrip = new BeepToolStrip();

// File operations
toolStrip.Items.Add(new BeepToolStripButton("New", "new.svg"));
toolStrip.Items.Add(new BeepToolStripButton("Open", "open.svg"));
toolStrip.Items.Add(new BeepToolStripButton("Save", "save.svg"));

// Add separator
toolStrip.Items.Add(new BeepToolStripSeparator());

// Edit operations
toolStrip.Items.Add(new BeepToolStripButton("Cut", "cut.svg"));
toolStrip.Items.Add(new BeepToolStripButton("Copy", "copy.svg"));
toolStrip.Items.Add(new BeepToolStripButton("Paste", "paste.svg"));

// Add separator
toolStrip.Items.Add(new BeepToolStripSeparator());

// Format dropdown
var formatDropdown = new BeepToolStripDropDownButton("Format", "format.svg");
formatDropdown.DropDownItems.Add(new BeepToolStripMenuItem("Bold"));
formatDropdown.DropDownItems.Add(new BeepToolStripMenuItem("Italic"));
formatDropdown.DropDownItems.Add(new BeepToolStripMenuItem("Underline"));
toolStrip.Items.Add(formatDropdown);

Properties

Core Properties

Property Type Default Description
Items ToolStripItemCollection Empty Collection of tool strip items
Dock DockStyle Top Docking position in parent container
ShowGrip bool true Show/hide the drag handle
ImageList ImageList null Image list for tool strip icons

Appearance Properties

Property Type Default Description
RenderMode ToolStripRenderMode System Rendering style for the tool strip
ImageScalingSize Size 16x16 Size for scaling tool strip images
AutoSize bool true Automatically size to fit content

Examples

Complete Application Toolbar

public void CreateApplicationToolbar()
{
    var mainToolStrip = new BeepToolStrip
    {
        Name = "mainToolStrip",
        Dock = DockStyle.Top,
        ImageScalingSize = new Size(24, 24),
        Theme = "Professional"
    };

    // File operations section
    AddFileOperations(mainToolStrip);
    mainToolStrip.Items.Add(new BeepToolStripSeparator());

    // Edit operations section
    AddEditOperations(mainToolStrip);
    mainToolStrip.Items.Add(new BeepToolStripSeparator());

    // View operations section
    AddViewOperations(mainToolStrip);
    mainToolStrip.Items.Add(new BeepToolStripSeparator());

    // Tools section
    AddToolsSection(mainToolStrip);

    this.Controls.Add(mainToolStrip);
}

private void AddFileOperations(BeepToolStrip toolStrip)
{
    var newButton = new BeepToolStripButton
    {
        Text = "New",
        Image = LoadIcon("new-file.svg"),
        ToolTipText = "Create new document (Ctrl+N)",
        Tag = "new"
    };
    newButton.Click += ToolButton_Click;
    toolStrip.Items.Add(newButton);

    var openButton = new BeepToolStripButton
    {
        Text = "Open",
        Image = LoadIcon("open-file.svg"),
        ToolTipText = "Open existing document (Ctrl+O)",
        Tag = "open"
    };
    openButton.Click += ToolButton_Click;
    toolStrip.Items.Add(openButton);

    var saveButton = new BeepToolStripButton
    {
        Text = "Save",
        Image = LoadIcon("save-file.svg"),
        ToolTipText = "Save current document (Ctrl+S)",
        Tag = "save"
    };
    saveButton.Click += ToolButton_Click;
    toolStrip.Items.Add(saveButton);

    var saveAsDropdown = new BeepToolStripDropDownButton
    {
        Text = "Save As",
        Image = LoadIcon("save-as.svg"),
        ToolTipText = "Save document with options"
    };
    
    saveAsDropdown.DropDownItems.Add(new BeepToolStripMenuItem("PDF", LoadIcon("pdf.svg")) { Tag = "save-pdf" });
    saveAsDropdown.DropDownItems.Add(new BeepToolStripMenuItem("Word", LoadIcon("word.svg")) { Tag = "save-word" });
    saveAsDropdown.DropDownItems.Add(new BeepToolStripMenuItem("Excel", LoadIcon("excel.svg")) { Tag = "save-excel" });
    
    foreach (BeepToolStripMenuItem item in saveAsDropdown.DropDownItems)
    {
        item.Click += ToolButton_Click;
    }
    
    toolStrip.Items.Add(saveAsDropdown);
}

private void AddEditOperations(BeepToolStrip toolStrip)
{
    var undoButton = new BeepToolStripButton
    {
        Text = "Undo",
        Image = LoadIcon("undo.svg"),
        ToolTipText = "Undo last action (Ctrl+Z)",
        Tag = "undo"
    };
    undoButton.Click += ToolButton_Click;
    toolStrip.Items.Add(undoButton);

    var redoButton = new BeepToolStripButton
    {
        Text = "Redo",
        Image = LoadIcon("redo.svg"),
        ToolTipText = "Redo last undone action (Ctrl+Y)",
        Tag = "redo"
    };
    redoButton.Click += ToolButton_Click;
    toolStrip.Items.Add(redoButton);

    toolStrip.Items.Add(new BeepToolStripSeparator());

    var cutButton = new BeepToolStripButton
    {
        Text = "Cut",
        Image = LoadIcon("cut.svg"),
        ToolTipText = "Cut selection (Ctrl+X)",
        Tag = "cut"
    };
    cutButton.Click += ToolButton_Click;
    toolStrip.Items.Add(cutButton);

    var copyButton = new BeepToolStripButton
    {
        Text = "Copy",
        Image = LoadIcon("copy.svg"),
        ToolTipText = "Copy selection (Ctrl+C)",
        Tag = "copy"
    };
    copyButton.Click += ToolButton_Click;
    toolStrip.Items.Add(copyButton);

    var pasteButton = new BeepToolStripButton
    {
        Text = "Paste",
        Image = LoadIcon("paste.svg"),
        ToolTipText = "Paste from clipboard (Ctrl+V)",
        Tag = "paste"
    };
    pasteButton.Click += ToolButton_Click;
    toolStrip.Items.Add(pasteButton);
}

private void ToolButton_Click(object sender, EventArgs e)
{
    var button = sender as BeepToolStripItem;
    var action = button?.Tag?.ToString();
    
    switch (action)
    {
        case "new":
            CreateNewDocument();
            break;
        case "open":
            OpenDocument();
            break;
        case "save":
            SaveDocument();
            break;
        case "save-pdf":
            SaveAsPDF();
            break;
        case "undo":
            UndoLastAction();
            break;
        case "redo":
            RedoLastAction();
            break;
        case "cut":
            CutSelection();
            break;
        case "copy":
            CopySelection();
            break;
        case "paste":
            PasteFromClipboard();
            break;
        default:
            MessageBox.Show($"Action '{action}' not implemented yet.");
            break;
    }
}

Theming

BeepToolStrip provides comprehensive theming support with automatic application of theme colors and styling:

Theme Application

var toolStrip = new BeepToolStrip
{
    Theme = "DarkTheme",
    RenderMode = ToolStripRenderMode.Professional
};

// Theme automatically applies:
// - BackColor: Tool strip background
// - ForeColor: Text and icon colors
// - Button hover and pressed states
// - Separator colors
// - Border styling

// Apply theme manually if needed
toolStrip.ApplyTheme();

Custom Styling

  • Professional renderer - Clean, modern appearance
  • System renderer - OS-native appearance
  • Custom renderer - Fully customizable styling
  • Theme integration - Automatic color scheme application

Best Practices

🎯 Design Guidelines

  • Group related actions: Use separators to group related functionality
  • Meaningful icons: Use clear, recognizable icons with tooltips
  • Consistent sizing: Maintain consistent icon and button sizes
  • Logical order: Arrange items in order of usage frequency

🔧 Implementation

  • Integrate with BeepMenuBar: Provide redundant access to menu commands
  • Handle overflow: Use overflow menu for less common actions
  • Keyboard shortcuts: Include shortcut keys in tooltips
  • State management: Update button states based on context

⚡ Performance

  • Optimize images: Use appropriate image sizes and formats
  • Lazy loading: Load dropdown content on demand
  • Event handling: Use efficient event delegation patterns
  • Memory management: Properly dispose of resources
💡 Design Tip

Place the most frequently used actions at the beginning of the tool strip and group related functions with separators for better user experience.

✅ Best Practice

Use BeepToolStrip in combination with BeepMenuBar to provide both menu-based and direct toolbar access to application features.