c# - Optimize DPI aware application for custom DPI settings -
i'm writing dpi aware application. compatible 100%, 125%, 150% , 200% scaling. if use custom setting of 130% example, takes code of 200% instead of 125%. possible optimize application custom dpi settings without having 100 ifs?
i'm using following code:
graphics g = this.creategraphics(); if (g.dpix < 120) { t.itemsize = new size(245, 22); } else if (g.dpix == 120) { t.itemsize = new size(329, 28); } else if (g.dpix == 144) { if (g.dpix > 195) { t.itemsize = new size(494, 44); } else { t.itemsize = new size(368, 33); } } else { t.itemsize = new size(494, 44); } edit:
using code now:
graphics g = this.creategraphics(); if (g.dpix < 120) { t.itemsize = new size(245, 22); } else if (g.dpix >= 120 && g.dpix < 144) { t.itemsize = new size(329, 28); } else if (g.dpix >= 144 && g.dpix < 196) { if (g.dpix >= 196) { t.itemsize = new size(494, 44); } else { t.itemsize = new size(368, 33); } } else { t.itemsize = new size(494, 44); } the result 200% uses code of 150% reason? did miss something?
Comments
Post a Comment