Q&A

  • 문자열의 pixel단위의 길이를 계산하는 방법
굴림체 폰트로 'killing Field' 와 같은 문자열의 실제 Pixel 길이를 계산하는 방법을 알고싶습니다.

i,L등의 길이가 변경됨으로 계산하는 방법이 있는것같은데 방법을 모르겠습니다.

고수님들의 조언 부탁드립니다.
1  COMMENTS
  • Profile
    하얀까마귀 2003.01.13 21:12
    안녕하세요 하얀까마귀 입니다.

    GetTextExtentPoint32

    라는 함수를 이용하시면 원하시는 값을 구할수 있을것 같네요..

    BOOL GetTextExtentPoint32(

        HDC hdc,        // handle of device context
        LPCTSTR lpString,        // address of text string
        int cbString,        // number of characters in string
        LPSIZE lpSize         // address of structure for string size  
       );

    lpSize의 cx, cy 가 width 와 Height 입니다.