I am creating a small Flex UI component that displays a colored square next to a text label. I want to be able to specify the size of the square and internally adjust the properties of the label so that the height of the line matches the square, and the text is vertically centered relative to the square.
At the moment I'm using mx.controls.Labelfor text. Setting the style fontSizeto square size does not work, the label becomes too large. After tracking multiple values in the debugger, I found that
mx.controls.Label
fontSize
ascent
descent
TextFieldMetrics
getTextFieldMetircs()
Label
getTextFieldMetrics().height
My current solution is to set the font size to Math.round((iconSize - 2) / 1.2), but as long as this works OK, it seems unsatisfactory. Is there a more reliable and simpler approach to this?
Math.round((iconSize - 2) / 1.2)
, UITextField Label, : , , , . , getTextLineMetrics(), .
UITextField
getTextLineMetrics()
UITextField , , fontSize, ( 2-4 ). , , , , leading .
leading
Label , fontSize, ( 5 ).
, , , Label , . . , , getTextLineMetrics() .
Source: https://habr.com/ru/post/1773839/More articles:How to authenticate, filter and verify the result of oData based on WCF? - filterContextual switching of streams - c ++WCF Request Interceptors: Does this MSDN Check for Security Risk? - securityLive story from stdin - plotInstalling a Windows service using WIX - installer"Syntax error, unexpected T_STRING error" with goto - stringIs the new Macbook Air 13 "fast enough to develop Xcode and iOS? - iosПочему функция не определена в файле .o для этого класса С++? - c++URLRewriter for IIS 7 returns 404 Server Error - asp.netapache mod-rewrite: Can I have different rules for POST and GET requests? - apacheAll Articles