Pregunta

Considere System.Windows.Forms.StatusStrip . He agregado un StatusStrip a mi aplicación de formularios Windows Forms, pero tengo algunos problemas.

Me gustaría tener una etiqueta anclada a la izquierda y una barra de progreso anclada a la derecha en StatusStrip, pero no puedo encontrar una manera de establecer estas propiedades.

Entonces pensé que podría necesitar crear dos StatusStrips y anclarlas a cada lado de la parte inferior del formulario ... Eso no funcionó; Además de eso, simplemente no se siente bien.

¿Fue útil?

Solución

Simplemente configure la propiedad Spring en el control de etiqueta en True y debería estar listo.

Otros consejos

Lo que debe hacer es establecer la propiedad de alineación de su barra de progreso a la derecha. Luego establezca el LayoutStyle de StatusStrip en 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;

Esto se puede lograr con el diseño de tabla predeterminado para el statusStrip simplemente colocando otra etiqueta entre su etiqueta actual y su barra de progreso y establezca la propiedad Spring en verdadero.

¿Has probado el Alineamiento propiedad de ProgresBarToolStripItem establecido en Derecho ?

Abra su Diseñador y configure this.toolStripStatusLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top