using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public static void AutoScale(Form frm)
{
frm.Tag = frm.Width.ToString() + "," + frm.Height.ToString();
frm.SizeChanged += new EventHandler(Form1_SizeChanged);
}
static void Form1_SizeChanged(object sender, EventArgs e)
{
string[] tmp = ((Form)sender).Tag.ToString().Split(',');
float width = (float)((Form)sender).Width / (float)Convert.ToInt16(tmp[0]);
float heigth = (float)((Form)sender).Height / (float)Convert.ToInt16(tmp[1]);
// Single currentSize = Convert.ToSingle((float)Convert.ToInt16(tmp[2]));
((Form)sender).Tag = ((Form)sender).Width.ToString() + "," + ((Form)sender).Height;
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载