C#适应不同分辨率
来源:互联网 发布:c语言实验体会 编辑:程序博客网 时间:2024/05/21 10:03
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
WindowsApplication1.Instance.InitInstance(this);
}
}
}
实现方法的类:
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsApplication1
{
public class Instance
{
public static void InitInstance(System.Windows.Forms.Form form)
{
form.Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Screen sc = Screen.PrimaryScreen;
float w = sc.Bounds.Width;
float h = sc.Bounds.Height;
foreach (Control c in form.Controls)
{
// 1024 768 为当前窗体设计的尺寸
c.Size = new Size((int)(c.Width * w / 1024),(int) (c.Height * h / 768));
c.Location = new Point((int)(c.Left * w / 1024),(int)( c.Top * h / 768));
Single size = Convert.ToSingle(c.Font.Size *h/768);
c.Font = new Font(c.Font.Name,size,c.Font.Style,c.Font.Unit);
}
}
}
}
- C#适应不同分辨率
- 浏览器适应不同分辨率
- android 布局适应不同分辨率
- cocos2d-x 适应不同分辨率 .
- VC++对话框适应不同分辨率
- 网页 如何适应不同分辨率
- android 不同分辨率,屏幕适应
- 网页适应不同的分辨率
- 使form适应不同的显示分辨率
- 网页适应不同 浏览器和分辨率
- 如何让网页适应不同分辨率
- 设置宽高适应不同的分辨率
- 不同分辨率下,字体大小怎么适应?
- (转)android 按比例布局 适应不同分辨率
- Android--让app适应不同分辨率
- 让字体适应不同的分辨率
- 如何让android app适应不同分辨率
- cocos2d-x 适应不同分辨率 (转)
- 第八周项目1-计算加班费
- linux 替换目录下所有文件中某个字符串命令
- IOS开发之手势——UIGestureRecognizer 共存
- Codeforces Round #207 (Div. 1)
- windows获得服务配置(驱动路径)
- C#适应不同分辨率
- 金山2014校园招聘C++程序设计题
- python mysql 2014 Commands out of sync; you can't run this command now
- 界面
- MinGW编译wxWidgets问题
- 基于Freemarker模板技术的邮件发送模块设计
- 计算机的启动方式(冷启动、热启动、复位启动)、注销、待机
- wiki-1004-四子连棋
- 南京第一个项目遇到的问题(easyui)