C#에서 StatusStrip 사용
-
22-07-2019 - |
문제
고려하다 System.windows.forms.statusStrip. Windows 양식 응용 프로그램에 StatusStrip을 추가했지만 몇 가지 문제가 있습니다.
왼쪽에 레이블을 고정하고 StatusStrip의 오른쪽에 고정 된 ProgressBar를 원하지만 이러한 속성을 설정하는 방법을 찾을 수는 없습니다.
그런 다음 두 개의 StatusStrips를 만들어 양식의 바닥의 양쪽에 고정해야한다고 생각했습니다. 그 외에도, 그것은 옳지 않습니다.
해결책
그냥 설정하십시오 Spring
레이블 컨트롤의 속성 True
그리고 당신은 가기에 좋을 것입니다.
다른 팁
당신이해야 할 일은 ProgressBar의 정렬 속성을 오른쪽으로 설정하는 것입니다. 그런 다음 StatusStrip의 레이아웃 스타일을 OVERVERFLOW로 HORIZONTALSTACK로 설정하십시오.
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;
이것은 현재 레이블과 진행 상황 사이에 다른 레이블을 넣고 스프링 속성을 true로 설정하여 StatusStrip의 기본 테이블 레이아웃으로 달성 할 수 있습니다.
디자이너를 열고 this.toolstripstatuslabel1.alignment = system.windows.forms.toolstripitemalignment.right;
제휴하지 않습니다 StackOverflow