获取button 文字的方法
- using (Graphics cg = this.CreateGraphics())
- {
- SizeF size = cg.MeasureString("Please excuse my dear aunt sally", this.button1.Font);
- // size.Width+= 3; //add some padding .net v1.1 and 1.0 only
-
- this.button1.Width = (int)size.Width;
- this.button1.Text = "Please excuse my dear aunt sally";
- }
复制代码 |