MFC对话框控件随对话框的大小变化
2015-11-03 23:31
267 查看
//控件随窗体自动缩放 string[] tmp = new string[2]; 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]); ((Form)sender).Tag = ((Form)sender).Width.ToString() + "," + ((Form)sender).Height; foreach (Control control in ((Form)sender).Controls) { control.Scale(new SizeF(width, heigth)); }使用该代码注意事项:1,此段代码基本通用。2,此段代码写在窗体的加载事件中。3,若窗体需要缩小,请再写在窗体的SizeChanged事件中。
相关文章推荐
- [css]我要用css画幅画(一)
- 2015/11/3 完成酷欧天气的数据库、网络连接类的编写
- cf592d
- coredata 详解
- Qt在线安装
- 软件测试简介、测试原则、测试过程、测试内容、测试方法
- 分成互质组
- 数据结构_树形结构_二叉树
- UGUI事件解析
- python3 与 python2的 区别比较
- 关于内存对齐
- hive 建表例子
- Spring+Mybatis+Mysql搭建分布式数据库访问框架
- DirectX 3D纹理
- 深入解析单例模式
- HDU 3435 A new Graph Game (KM)
- Oracle Exception In Loop
- leetcode-Sliding Window Maximum
- HighCharts 曲线
- 家庭作业