나는 영역 내에서 렌더링 될 텍스트를 요구하는 함수를 사용하고 있습니다. 함수의 기본 작동은 다음과 이에너무 많은 공백을 허용하는 Graphics.MeasureString
Dim measureSize as Size
Do
myFont = new Font(myFont.Name, myFont.Size - 1, FontStyle.Regular, GraphicsUnit.Document)
'Initial font size is set insanely high for the moment, during testing.
'Low initial font size is not the problem.
measureSize = g.MeasureString(myString, myFont)
Loop until (measuredSize.width < desiredSize.width AND measuredSize.height < desiredSize.height)
문제는 MeasureString가 드로잉 된 캐릭터의 주위의 공백을 많이 첨가하고, 최종 폰트가 너무 작은 렌더링되는 점이다.
MeasureString 메서드에서 모든 패딩을 제거하기 위해 필자가 피할 수있는 몇 가지 인수를 기억하지만 확실하게 검색 결과에 아무런 변화가 없습니다.
아무도 경계없이 문자열의 정확한 크기를 측정하기 위해 MeasureString을 사용하는 방법을 알고 있습니까? 그것은 텍스트의 크기보다는 텍스트 앤티 앨리어싱 경우의 크기를 반환으로 http://www.codeproject.com/KB/GDI-plus/measurestring.aspx