Mit Statuss in C #
-
22-07-2019 - |
Frage
System.Windows.Forms.StatusStrip . Ich habe eine Statuss meiner Windows Forms-Anwendung hinzugefügt, aber ich habe ein paar Probleme.
Ich möchte einen Aufkleber an der linken Seite und einem progressbar auf der rechten Seite in der Statuss verankert verankert haben, aber ich kann nicht einen Weg finden, um diese Eigenschaften zu setzen.
Ich dachte dann, dass ich kann zwei StatusStrips erstellen und diese auf beiden Seiten des Bodens der Form verankert ... Das nicht pan out; Abgesehen davon, es fühlt sich einfach nicht richtig.
Lösung
Stellen Sie einfach die Spring
Eigenschaft auf dem Label-Steuerelement True
und Sie sollten gut gehen.
Andere Tipps
Was Sie tun müssen, um die Ausrichtung Eigentum Ihrer progressbar nach rechts gesetzt. Dann stellen Sie den Layoutstyle des Statuss zu 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;
Dies kann indem man einfach ein anderes Label zwischen Ihrem aktuellen Etikett und Ihrer progressBar und stellen Sie den Frühling Eigenschaft auf true mit dem Standard-Tabellen-Layout für den Statuss erreicht werden.
Haben Sie versucht, die Ausrichtung Eigenschaft ProgresBarToolStripItem auf das Right ?
Öffnen Sie Ihre Designer und setzen this.toolStripStatusLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;