C#的label控件运行是怎样通过代码修改大小。例如我在窗体放一个label 两个button 当单击一个button时 200
1个回答
2017-08-09
展开全部
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
label1.Width = 100;
label1.AutoSize = false;
label1.Text = "01234567890123456789";
}
private void button1_Click(object sender, EventArgs e)
{
label1.Width = label1.Width / 2;
}
private void button2_Click(object sender, EventArgs e)
{
label1.Width = label1.Width * 2;
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
label1.Width = 100;
label1.AutoSize = false;
label1.Text = "01234567890123456789";
}
private void button1_Click(object sender, EventArgs e)
{
label1.Width = label1.Width / 2;
}
private void button2_Click(object sender, EventArgs e)
{
label1.Width = label1.Width * 2;
}
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |