gdi+ - C# Scaling GDI positions but not font size or line thickness -


i need lot of drawing on grid spacing of 12.5 pixels x , 20 pixels y (the pica scale). font needs specific size , lines need still 1 pixel thick. i'm saving these values in floats , multiplying them (for example, text starting on row 3, column 6 drawn coords 2f*cx,5f*cy). i'd avoid unnecessary multiplication using scale transform, unfortunately affect font size , line thickness well. there way avoid this? or compiler silently doing me cx/cy values constants?

the compiler should reduce constant portion of expressions single constant, there still have multiply @ runtime since value of float not known @ compile time. so, (1 + 2 + c) * 6 * f can reduced n * f compiler if c constant.

your best bet prevent scaling of text set scaling transform, draw non-text graphics don't care maintaining minimum line widths, draw text without using transform. can use transform locate text should start save having calculate independently - function lptodp (logical point device point) should trick.

another other way approach render text in transform, apply reverse scaling text size itself. so, if transform scales down 5%, scale font size 5%. not give exact results, might close enough visuals.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -