سلام دوست عزیز
این یه سمپل
http://s9.picofile.com/file/8319293068/Sample.zip.html
و میبایست رفرنس DevExpress.XtraEditors.XtraForm به پروژت اضافه کنی من کمی گرفتارم اگه رفرنس رو از این سایت دانلود کنی مشکلت حله
البته فکر کنم همون devcomponent داخلش داشته باشه
برای نمونه 1024*768 رو تو این پروژه اعمال کرده میتونی تغییرش بدی
اینم ادرس https://www.devexpress.com
public partial class Form1 : DevExpress.XtraEditors.XtraForm {
public Form1() {
InitializeComponent();
}
const float designWidth = 1024f;
const float designHeight = 768f;
const float defaultFont = 8.2f;
int runtimeWidth = Screen.PrimaryScreen.Bounds.Width;
int runtimeHeight = Screen.PrimaryScreen.Bounds.Height;
private void Form1_Load(object sender, EventArgs e) {
float width_ratio = (runtimeWidth / designWidth);
float heigh_ratio = (runtimeHeight / designHeight);
SizeF scale = new SizeF(width_ratio, heigh_ratio);
this.Scale(scale);
float designRatio = designWidth / designHeight;
float runtimeRatio = runtimeWidth / runtimeHeight;
float fontPercentageF = designRatio * 100 / runtimeRatio;
float defaultFontResultiveDimention = defaultFont * fontPercentageF / 100;
foreach(Control control in this.Controls) {
float resultantFont = control.Font.SizeInPoints * fontPercentageF / 100;
control.Font = new Font("Microsoft Sans Serif", resultantFont);
//control.Font = new Font("Microsoft Sans Serif", control.Font.SizeInPoints * (width_ratio / heigh_ratio));
}
}
}
}