WinForm程序设计-壮态栏控件(statusBar)

Rectangle rect = new Rectangle ( ) ;
rect=Screen.GetWorkingArea(this);
//让壮态栏控件的宽度与显示器的分辨率宽度一致
int statusBar_Width=(rect.Width-statusBar.Panels[0].Width-statusBar.Panels[1].Width
-statusBar.Panels[2].Width-statusBar.Panels[3].Width-statusBar.Panels[4].Width)/5;
 statusBar.Width=rect.Width;
  statusBar.Panels[0].Width=statusBar.Panels[0].Width+statusBar_Width;
  statusBar.Panels[1].Width=statusBar.Panels[1].Width+statusBar_Width;
  statusBar.Panels[2].Width=statusBar.Panels[2].Width+statusBar_Width;
  statusBar.Panels[3].Width=statusBar.Panels[3].Width+statusBar_Width
  statusBar.Panels[4].Width=statusBar.Panels[4].Width+statusBar_Width;
//给壮态栏控件的子项赋值
  this.statusBar.Panels[0].Text="当前用户:"+l_username.ToString();
  this.statusBar.Panels[1].Text="职位:"+l_station.ToString();

你可能感兴趣的:(程序设计,WinForm,StatusBar,休闲,壮态栏控件)