子窗体随主窗体一起放大缩小问题 主窗体打开时有几个子窗体,怎么样使子窗体随主窗体一起放大缩小? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在主窗体Resize事件里改变子窗体的width,height SizeChanged事件里面操作子窗体的高和宽 在主窗体Resize事件里改变子窗体的width,height private void Form1_SizeChanged(object sender, EventArgs e) { //Form2 subform = new Form2(); if (this.WindowState == FormWindowState.Maximized) { foreach (Form obj in this.MdiChildren) { obj.WindowState = FormWindowState.Maximized; obj.Show(); } } }实现了,测过 private void main_SizeChanged(object sender, EventArgs e) { foreach (Form obj in this.MdiChildren) { obj.WindowState = FormWindowState.Minimized; obj.Show(); } if (this.WindowState == FormWindowState.Minimized) { this.cmsNinSystemShow.Enabled = true; this.cmsNinSystemHide.Enabled = false; this.ShowInTaskbar = false; } else { this.cmsNinSystemShow.Enabled = false; this.cmsNinSystemHide.Enabled = true; this.ShowInTaskbar = true; } } bool isno = false;//控制是否第一次改变。因为第一次打开主窗体里就会执行Resize事件 int IntoHeight, IntoWidth;//放入每次改变时的父窗体值 float TempHeight, TempWidth;//获得每次放大放小的比例值 private void main_Load(object sender, EventArgs e) { isno = true; IntoHeight = this.Height; IntoWidth = this.Width; } private void main_Resize(object sender, EventArgs e) { if (isno) { TempHeight = float.Parse(this.Height.ToString()) / float.Parse(this.IntoHeight.ToString()); TempWidth = float.Parse(this.Width.ToString()) / float.Parse(this.IntoWidth.ToString()); IntoHeight = this.Height; IntoWidth = this.Width; ChangAllChildRenSize(); } } public void ChangAllChildRenSize() { foreach (Form tempChildForm in this.MdiChildren) { tempChildForm.Height = int.Parse(Convert.ToString(Math.Round(tempChildForm.Height * TempHeight,0))); tempChildForm.Width = int.Parse(Convert.ToString(Math.Round(tempChildForm.Width * TempWidth,0))); } } 如何使用excel模板实现打印预览的功能 关于GPS蓝牙串口通信问题? vs与SQL 2005连接问题 请教一下怎么在datagrid里面显示checkbox? 安装卸载问题? 加密狗端口代码? 事件上传 ——————急急!!!请高手给于解答 今天的面食题,关于多线程的 我选了一个下拉框选项为什么会没反应??DropDownList1_SelectedIndexChanged好像不起作用,请问vc里的updateData()在C#是什么函数? .NET的安装问题,急 使用List<> 的 Add 方法时,最后一个增加的会把以前的都覆盖掉 C#类型转换面试题
private void Form1_SizeChanged(object sender, EventArgs e)
{
//Form2 subform = new Form2();
if (this.WindowState == FormWindowState.Maximized)
{
foreach (Form obj in this.MdiChildren)
{
obj.WindowState = FormWindowState.Maximized;
obj.Show();
}
}
}
实现了,测过
private void main_SizeChanged(object sender, EventArgs e)
{
foreach (Form obj in this.MdiChildren)
{
obj.WindowState = FormWindowState.Minimized;
obj.Show();
}
if (this.WindowState == FormWindowState.Minimized)
{
this.cmsNinSystemShow.Enabled = true;
this.cmsNinSystemHide.Enabled = false;
this.ShowInTaskbar = false;
}
else
{
this.cmsNinSystemShow.Enabled = false;
this.cmsNinSystemHide.Enabled = true;
this.ShowInTaskbar = true;
}
}
int IntoHeight, IntoWidth;//放入每次改变时的父窗体值
float TempHeight, TempWidth;//获得每次放大放小的比例值 private void main_Load(object sender, EventArgs e)
{
isno = true;
IntoHeight = this.Height; IntoWidth = this.Width;
} private void main_Resize(object sender, EventArgs e)
{
if (isno)
{
TempHeight = float.Parse(this.Height.ToString()) / float.Parse(this.IntoHeight.ToString());
TempWidth = float.Parse(this.Width.ToString()) / float.Parse(this.IntoWidth.ToString());
IntoHeight = this.Height; IntoWidth = this.Width;
ChangAllChildRenSize();
}
} public void ChangAllChildRenSize()
{
foreach (Form tempChildForm in this.MdiChildren)
{
tempChildForm.Height = int.Parse(Convert.ToString(Math.Round(tempChildForm.Height * TempHeight,0)));
tempChildForm.Width = int.Parse(Convert.ToString(Math.Round(tempChildForm.Width * TempWidth,0)));
}
}