日期:2014-05-17 浏览次数:20867 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
namespace 放大和缩小界面
{
class resize : Form
{
public void firstDemo(Form it)
{
try
{
int count = it.Controls.Count * 2 + 2;
float[] factor = new float[count];
int i = 0;
factor[i++] = Size.Width;
factor[i++] = Size.Height;
foreach (Control ctrl in it.Controls)
{
factor[i++] = ctrl.Location.X / (float)Size.Width;
factor[i++] = ctrl.Location.Y / (float)Size.Height;
ctrl.Tag = ctrl.Size;
}
Tag = factor;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
public void resizeStatus(Form it)
{
try
{
float[] scale = (float[])Tag;
int i = 2;
foreach (Control ctrl in it.Controls)
{
&nbs