c# - Obtaining the logical pixel width of any character in visual studio editor? -


i'm making editor extension vs2012, , need find logical pixel width of character in editor.

i think characters share same width, shared width changes zoom amount of editor changes; when zoom @ 100%, characters 7 logical pixels wide, otherwise they're 7.33 logical pixels wide.

i can find width of character writing:
// textview itextview
textview.caret.containingtextviewline.textwidth /
textview.caret.containingtextviewline.length

however, problem when line caret on empty, since division zero.

i didn't find answer question, found solution problem:

virtualsnapshotpoint get_point(itextcaret caret)     {     caret.containingtextviewline.getinsertionbufferpositionfromxcoordinate(...);     } 

that method made unnecessary me work logical pixel width of character.


Comments