zoukankan      html  css  js  c++  java
  • CDC字符串长宽和字体信息。

    老是忘。

    CSize GetTextExtent( LPCTSTR lpszString, int nCount ) const;

    CSize GetTextExtent( const CString& str ) const;

    Return Value

    The dimensions of the string (in logical units) in a CSize object.

    Remarks

    Call this member function to compute the width and height of a line of text using the current font to determine the dimensions. The information is retrieved from m_hAttribDC, the attribute device context.

    The current clipping region does not affect the width and height returned by GetTextExtent.

    Since some devices do not place characters in regular cell arrays (that is, they carry out kerning), the sum of the extents of the characters in a string may not be equal to the extent of the string.

    BOOL GetTextMetrics( LPTEXTMETRIC lpMetrics ) const;

    Return Value

    Nonzero if the function is successful; otherwise 0.

    Remarks

    Retrieves the metrics for the current font using the attribute device context.

    typedef struct tagTEXTMETRIC {  /* tm */
       int  tmHeight;
       int  tmAscent;
       int  tmDescent;
       int  tmInternalLeading;
       int  tmExternalLeading;
       int  tmAveCharWidth;
       int  tmMaxCharWidth;
       int  tmWeight;
       BYTE tmItalic;
       BYTE tmUnderlined;
       BYTE tmStruckOut;
       BYTE tmFirstChar;
       BYTE tmLastChar;
       BYTE tmDefaultChar;
       BYTE tmBreakChar;
       BYTE tmPitchAndFamily;
       BYTE tmCharSet;
       int  tmOverhang;
       int  tmDigitizedAspectX;
       int  tmDigitizedAspectY;
    } TEXTMETRIC;

  • 相关阅读:
    数据库
    java语法
    《Lucene实战(第2版)》 配书代码在IDEA下的编译方法
    lucene学习
    社交关系调研(费)
    微博开发平台java SDK demo学习之examples(demo)
    微博开发平台java SDK demo学习之friendships
    F. Classical? (数论 + 思维 + 推理 + 容斥)
    石子合并问题,经典区间DP
    luoguP2048 [NOI2010]超级钢琴
  • 原文地址:https://www.cnblogs.com/aoyihuashao/p/1683806.html
Copyright © 2011-2022 走看看