namespace ch
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//这里我是让textbox与自己的form保持一定的距离和大小关系
int[] changetextboxsize(Form f, int left, int top)
{
int[] r = new int[2];
int width = f.Width;
int height = f.Height;
int newwidth = width - left - 50;
int newheight = height - top - 100;
r[0] = newwidth;
r[1] = newheight;
return r;
}
public void GOGOGO()
{
int left = textBox1.Left;
int top = textBox1.Top;
int[] r = changetextboxsize(this, left, top);
textBox1.Width = r[0];
textBox1.Height = r[1];
textBox1.Refresh();
}
private void Form1_Load(object sender, EventArgs e)
{
GOGOGO();
}
private void Form1_SizeChanged(object sender, EventArgs e)
{
GOGOGO();
}
}
}
页面更新:2024-04-15
本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828
© CopyRight 2008-2024 All Rights Reserved. Powered By bs178.com 闽ICP备11008920号-3
闽公网安备35020302034844号