Ответ 1
Просто установите свойство Spring
в элементе управления меткой True
, и вам должно быть хорошо идти.
Рассмотрим System.Windows.Forms.StatusStrip. Я добавил StatusStrip в мое приложение Windows Forms, но у меня есть несколько проблем.
Я хотел бы иметь метку, привязанную слева, и индикатор прогресса, закрепленный справа в StatusStrip, но я не могу найти способ установить эти свойства.
Тогда я подумал, что мне может понадобиться создать два StatusStrips и привязать их по обе стороны от нижней части формы... Это не было отключено; кроме того, он просто не чувствует себя хорошо.
Просто установите свойство Spring
в элементе управления меткой True
, и вам должно быть хорошо идти.
Что вам нужно сделать, это установить свойство выравнивания вашей панели прогресса вправо. Затем установите LayoutStyle для StatusStrip в 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;
Это может быть достигнуто с помощью макета таблицы по умолчанию для statusStrip, просто поместив еще одну метку между текущей меткой и вашим progressBar и установите для свойства Spring значение true.
Вы пробовали Alignment свойство ProgresBarToolStripItem, установленное в Right?
Откройте конструктор и установите this.toolStripStatusLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;