VB.NET, C#, PowerShellを使用しているエンジニアのためのサイト。
基本的な使用方法から開発で役立つTipsまで幅広く取り扱っています。
ボタンに表示されるテキストの位置を設定するには、TextAlignプロパティを使用します。TextAlignプロパティにはContentAlignment列挙体をセットします。
ContentAlignment列挙体
メンバ名 | 説明 |
---|---|
BottomCenter | 下端中央 |
BottomLeft | 下端左寄せ |
BottomRight | 下端右寄せ |
MiddleCenter | 中段中央 |
MiddleLeft | 中段左寄せ |
MiddleRight | 中段右寄せ |
TopCenter | 上段中央 |
TopLeft | 上段左寄せ |
TopRight | 上段右寄せ |
private void Form1_Load(object sender, System.EventArgs e) { button1.TextAlign = ContentAlignment.TopLeft; button2.TextAlign = ContentAlignment.TopCenter; button3.TextAlign = ContentAlignment.TopRight; button4.TextAlign = ContentAlignment.MiddleLeft; button5.TextAlign = ContentAlignment.MiddleCenter; button6.TextAlign = ContentAlignment.MiddleRight; button7.TextAlign = ContentAlignment.BottomLeft; button8.TextAlign = ContentAlignment.BottomCenter; button9.TextAlign = ContentAlignment.BottomRight; }