VB.NET, C#, PowerShellを使用しているエンジニアのためのサイト。
基本的な使用方法から開発で役立つTipsまで幅広く取り扱っています。
パネルに表示するテキストの配置方法を設定するには、Alignmentプロパティを使用します。
private void Form1_Load(object sender, System.EventArgs e) { StatusBarPanel stbPnl1 = new StatusBarPanel(); StatusBarPanel stbPnl2 = new StatusBarPanel(); StatusBarPanel stbPnl3 = new StatusBarPanel(); //各パネルに表示するテキストを指定 stbPnl1.Text = "ここにメッセージを表示"; stbPnl2.Text = "ホスト名:" + System.Net.Dns.GetHostName(); stbPnl3.Text = DateTime.Now.ToShortDateString(); //=== テキストの配置方法を設定する Alignmentプロパティを使用 === //テキストを左揃えにする stbPnl1.Alignment = HorizontalAlignment.Left; //テキストを右揃えにする stbPnl2.Alignment = HorizontalAlignment.Right; //テキストを中央揃えにする stbPnl3.Alignment = HorizontalAlignment.Center; //ステータスバーにパネルを追加 statusBar1.Panels.Add(stbPnl1); statusBar1.Panels.Add(stbPnl2); statusBar1.Panels.Add(stbPnl3); //パネルを表示する statusBar1.ShowPanels = true; }