c# - How to get the distance between the baseline of text and the horizontal border of a label? -


i want exact distance between baseline of text , bottom border of label in c#. want because want draw line under text (don't want use underlined font, because it's tight/close text).

here try:

//this placed in custom label class int dy = (int)((clientrectangle.height - font.getheight())/2); 

but it's not exact, dy returns 3 , line drawn label far baseline of text.

to text baseline label, assuming inside custom label class, in drawing handler.

font myfont = this.font; fontfamily ff = myfont.fontfamily;  float linespace = ff.getlinespacing(myfont.style); float ascent = ff.getcellascent(myfont.style); float baseline = myfont.getheight(e.graphics) * ascent / linespace; 

credit goes here.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -