考虑 系统.Windows.Forms.StatusStrip. 。我已将 StatusStrip 添加到我的 Windows 窗体应用程序中,但遇到了一些问题。

我希望在 StatusStrip 中的左侧锚定一个标签,在右侧锚定一个进度条,但我找不到设置这些属性的方法。

然后我想我可能需要创建两个 StatusStrip 并将它们锚定在表单底部的两侧......但这并没有成功。除此之外,感觉不太对劲。

有帮助吗?

解决方案

只要设置上的标签控制Spring属性True,你应该是好去。

其他提示

您要做的是将进度条的对齐属性设置为右。然后将 StatusStrip 的 LayoutStyle 设置为 Horizo​​ntalStackWithOverflow。

    private void InitializeComponent()
    {
        this.statusStrip1 = new System.Windows.Forms.StatusStrip();
        this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
        this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar();
        this.statusStrip1.SuspendLayout();
        this.SuspendLayout();
        // 
        // statusStrip1
        // 
        this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
    this.toolStripStatusLabel1,
    this.toolStripProgressBar1});
        this.statusStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
        this.statusStrip1.Location = new System.Drawing.Point(0, 250);
        this.statusStrip1.Name = "statusStrip1";
        this.statusStrip1.Size = new System.Drawing.Size(467, 22);
        this.statusStrip1.TabIndex = 0;
        this.statusStrip1.Text = "statusStrip1";
        // 
        // toolStripStatusLabel1
        // 
        this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
        this.toolStripStatusLabel1.Size = new System.Drawing.Size(117, 17);
        this.toolStripStatusLabel1.Text = "toolStripStatusLabel1";
        // 
        // toolStripProgressBar1
        // 
        this.toolStripProgressBar1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
        this.toolStripProgressBar1.Name = "toolStripProgressBar1";
        this.toolStripProgressBar1.Size = new System.Drawing.Size(100, 16);

    }

    private System.Windows.Forms.StatusStrip statusStrip1;
    private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
    private System.Windows.Forms.ToolStripProgressBar toolStripProgressBar1;

这可以为StatusStrip中的默认表布局,只需将您的当前标签,你的进度和Spring属性设置为true之间的另一个标签来实现。

你尝试过吗 结盟 ProgresBarToolStripItem 的属性设置为 正确的?

打开你的设计和设置 this.toolStripStatusLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top