get_string_extentsT_get_string_extentsGetStringExtentsGetStringExtentsget_string_extents (算子)
名称
get_string_extentsT_get_string_extentsGetStringExtentsGetStringExtentsget_string_extents — 获取字符串的空间大小。
签名
void GetStringExtents(const HTuple& WindowHandle, const HTuple& Values, HTuple* Ascent, HTuple* Descent, HTuple* Width, HTuple* Height)
HTuple HWindow::GetStringExtents(const HTuple& Values, HTuple* Descent, HTuple* Width, HTuple* Height) const
Hlong HWindow::GetStringExtents(const HString& Values, Hlong* Descent, Hlong* Width, Hlong* Height) const
Hlong HWindow::GetStringExtents(const char* Values, Hlong* Descent, Hlong* Width, Hlong* Height) const
Hlong HWindow::GetStringExtents(const wchar_t* Values, Hlong* Descent, Hlong* Width, Hlong* Height) const
(
Windows only)
static void HOperatorSet.GetStringExtents(HTuple windowHandle, HTuple values, out HTuple ascent, out HTuple descent, out HTuple width, out HTuple height)
HTuple HWindow.GetStringExtents(HTuple values, out HTuple descent, out HTuple width, out HTuple height)
int HWindow.GetStringExtents(string values, out int descent, out int width, out int height)
def get_string_extents(window_handle: HHandle, values: MaybeSequence[Union[str, float, int]]) -> Tuple[Union[int, float], Union[int, float], Union[int, float], Union[int, float]]
描述
get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsGetStringExtentsget_string_extents queries width and height of the output
size of a string using the font of the window. Thereby strings with
multiple lines are treated as if concatenated into a single line.
In addition, the extension above and below the baseline is returned
(AscentAscentAscentAscentascentascent and DescentDescentDescentDescentdescentdescent, respectively).
The sizes are measured in the coordinate system of the window (for
text windows in pixels). Using get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsGetStringExtentsget_string_extents, it is
possible to determine text output and input independently from the
used font. The conversion from integer numbers and floating point
numbers to text strings is the same as in write_stringwrite_stringWriteStringWriteStringWriteStringwrite_string。
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
WindowHandleWindowHandleWindowHandleWindowHandlewindowHandlewindow_handle (输入控制) window → HWindow, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
窗口句柄。
ValuesValuesValuesValuesvaluesvalues (输入控制) string(-array) → HTupleMaybeSequence[Union[str, float, int]]HTupleHtuple (string / real / integer) (string / double / int / long) (HString / double / Hlong) (char* / double / Hlong)
Values to consider.
默认值:
'test_string'
"test_string"
"test_string"
"test_string"
"test_string"
"test_string"
AscentAscentAscentAscentascentascent (输出控制) extent.y → HTupleUnion[int, float]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)
Maximum height above baseline.
DescentDescentDescentDescentdescentdescent (输出控制) extent.y → HTupleUnion[int, float]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)
Maximum extension below baseline.
WidthWidthWidthWidthwidthwidth (输出控制) extent.x → HTupleUnion[int, float]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)
Text width.
HeightHeightHeightHeightheightheight (输出控制) extent.y → HTupleUnion[int, float]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)
Text height.
结果
get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsGetStringExtentsget_string_extents returns 2 (
H_MSG_TRUE)
if the window is valid.否则将抛出异常。
可能的前趋
open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window,
set_fontset_fontSetFontSetFontSetFontset_font
可能的后继
set_tpositionset_tpositionSetTpositionSetTpositionSetTpositionset_tposition,
write_stringwrite_stringWriteStringWriteStringWriteStringwrite_string,
read_stringread_stringReadStringReadStringReadStringread_string,
read_charread_charReadCharReadCharReadCharread_char
另见
get_font_extentsget_font_extentsGetFontExtentsGetFontExtentsGetFontExtentsget_font_extents,
set_tpositionset_tpositionSetTpositionSetTpositionSetTpositionset_tposition,
set_fontset_fontSetFontSetFontSetFontset_font
模块
基础