C# での StatusStrip の使用
-
22-07-2019 - |
質問
考慮する System.Windows.Forms.StatusStrip. 。Windows フォーム アプリケーションに StatusStrip を追加しましたが、いくつか問題が発生しています。
StatusStrip の左側にラベルを固定し、右側にプログレスバーを固定したいのですが、これらのプロパティを設定する方法が見つかりません。
そこで、2 つの StatusStrip を作成し、フォームの下部の両側に固定する必要があるかもしれないと考えました。それはうまくいきませんでした。それ以外に、それは正しく感じられません。
解決
ラベルコントロールの Spring
プロパティを True
に設定するだけで準備完了です。
他のヒント
あなたがしなければならないことは、プログレスバーの配置プロパティを右に設定することです。次に、StatusStrip の LayoutStyle を horizontalStackWithOverflow に設定します。
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;
これは、現在のラベルとprogressBarの間に別のラベルを配置し、Springプロパティをtrueに設定するだけで、statusStripのデフォルトのテーブルレイアウトで実現できます。
Alignment プロパティ= "nofollow noreferrer">正しい?
デザイナーを開いて設定します this.toolStripStatusLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
所属していません StackOverflow