当前位置: 首页>>代码示例>>C#>>正文


C# StatusBarPanel.Icon属性代码示例

本文整理汇总了C#中System.Windows.Forms.StatusBarPanel.Icon属性的典型用法代码示例。如果您正苦于以下问题:C# StatusBarPanel.Icon属性的具体用法?C# StatusBarPanel.Icon怎么用?C# StatusBarPanel.Icon使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在System.Windows.Forms.StatusBarPanel的用法示例。


在下文中一共展示了StatusBarPanel.Icon属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StatusBarExample

//引入命名空间
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);

    }
  }
}
开发者ID:C#程序员,项目名称:System.Windows.Forms,代码行数:62,代码来源:StatusBarPanel.Icon


注:本文中的System.Windows.Forms.StatusBarPanel.Icon属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。