StatusBarPanel.Icon : StatusBarPanel « System.Windows.Forms « C# / C Sharp by API






StatusBarPanel.Icon

  
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace StatusBarExample
{
  public class StatusBarExample : System.Windows.Forms.Form
  {
    internal System.Windows.Forms.StatusBar statusBar;
    private System.ComponentModel.Container components = null;

    public StatusBarExample()
    {
      InitializeComponent();
    }
    private void InitializeComponent()
    {
      this.statusBar = new System.Windows.Forms.StatusBar();
      this.SuspendLayout();
      this.statusBar.Location = new System.Drawing.Point(0, 138);
      this.statusBar.Name = "statusBar";
      this.statusBar.ShowPanels = true;
      this.statusBar.Size = new System.Drawing.Size(292, 24);
      this.statusBar.SizingGrip = false;
      this.statusBar.TabIndex = 1;
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
      this.ClientSize = new System.Drawing.Size(292, 162);
      this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                      this.statusBar});
      this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
      this.Name = "StatusBarExample";
      this.Text = "StatusBar Example";
      this.Load += new System.EventHandler(this.StatusBarExample_Load);
      this.ResumeLayout(false);

    }
    static void Main() 
    {
      Application.Run(new StatusBarExample());
    }

    private void StatusBarExample_Load(object sender, System.EventArgs e)
    {
      StatusBarPanel pnlStatus = new StatusBarPanel();
      pnlStatus.Text = "Ready";
      pnlStatus.Icon = new Icon(Application.StartupPath + "\\active.ico");
      pnlStatus.AutoSize = StatusBarPanelAutoSize.Contents;

      StatusBarPanel pnlConnection = new StatusBarPanel();
      pnlConnection.Text = "Connected to " + "localhost";
      pnlConnection.AutoSize = StatusBarPanelAutoSize.Spring;

      statusBar.Panels.Add(pnlStatus);
      statusBar.Panels.Add(pnlConnection);

    }
  }
}

   
    
  








Related examples in the same category

1.StatusBarPanel.BorderStyle
2.StatusBarPanel.Text
3.StatusBarPanel.ToolTipText