这个程序是用代码来改变字体的位置,其实也就是通过代码来改变label控件的位置的一个小程序。
上代码:
1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using System.Threading.Tasks; 9 using System.Windows.Forms; 10 11 namespace Test3_4 12 { 13 public partial class Form1 : Form 14 { 15 public Form1() 16 { 17 InitializeComponent(); 18 } 19 20 private void 左边LToolStripMenuItem_Click(object sender, EventArgs e) 21 { 22 this.label1.Left = 0; 23 this.toolStripStatusLabel1.Text = "左边"; 24 } 25 26 private void 中间MToolStripMenuItem_Click(object sender, EventArgs e) 27 { 28 this.label1.Left = 70; 29 this.toolStripStatusLabel1.Text = "中间"; 30 } 31 32 private void 右边RToolStripMenuItem_Click(object sender, EventArgs e) 33 { 34 this.label1.Left = 145; 35 this.toolStripStatusLabel1.Text = "右边"; 36 } 37 38 private void toolStripButton1_Click(object sender, EventArgs e) 39 { 40 this.label1.Left = 0; 41 this.toolStripStatusLabel1.Text = "左边"; 42 } 43 44 private void toolStripButton2_Click(object sender, EventArgs e) 45 { 46 this.label1.Left = 70; 47 this.toolStripStatusLabel1.Text = "中间"; 48 } 49 50 private void toolStripButton3_Click(object sender, EventArgs e) 51 { 52 this.label1.Left = 145; 53 this.toolStripStatusLabel1.Text = "右边"; 54 } 55 } 56 }