DrawText显示文字的时候可以用DT_WORDBREAK自动换行,但换行后各行之间的行间距如何设置?
谢谢。
谢谢。
解决方案 »
- 如何根据我的变量去改变CEdit输入的限制字符?
- 请教 如何手动使窗口变灰并且失去焦点?
- 在多显示器独立显示的模式下,是否可以将应用程序发送到两个不同显示器中进行显示呢
- 如何在打开程序时同时打开两个子窗口?
- 请问如何实现Windows本身自带的安全加密属性?
- platform SDK 和win32 SDK 区别在哪里啊?
- SQLConfigDataSource 要包含什么头文件吗?
- 初级问题
- 请问如何删除一个类?
- 怎么才能动态调整CFormView中的dialog的大小?
- vc6.0的安装程序要更新java虚拟机,但每次重启后都失败,怎么办?
- 想问一下在VB中编写一个DLL文件,能否实现往固定IP,端口发送UDP包,怎样编?初初学,请各位多多指教!
LPCTSTR lpString, // pointer to string to draw
int nCount, // string length, in characters
LPRECT lpRect, // pointer to structure with formatting dimensions
UINT uFormat // text-drawing flags
);
关键是设置lpRect的范围大小来决定。
AnsiString S;
TRect TheRect;
TheRect = Rect(10,10,100,950);
S="请您对您的言行负责,并遵守中华人民共和国有关法律、法规,尊重网上道德。" ;
//改变下面的数值将会使行距变化
Canvas->Font->Height=80;
DrawText(Form1->Canvas->Handle,S.c_str(),S.Length(),&TheRect,DT_WORDBREAK);
***********************************
但我们应该知道,关键不是改变字体,而应该是在字体不变的情况下改变间距啊!
正在调试中....:P
Some applications determine the line spacing between text lines of different sizes by using a font's maximum ascender and descender. An application can retrieve these values by calling the GetTextMetrics function and then checking the tmAscent and tmDescent members of the TEXTMETRIC. The maximum ascent and descent are different from the typographic ascent and descent. In TrueType and OpenType fonts, the typographic ascent and descent are typically the top of the f glyph and bottom of the g glyph. An application can retrieve the typographic ascender and descender for a TrueType or OpenType font by calling the GetOutlineTextMetrics function and checking the values in the otmMacAscent and otmMacDescent members of the OUTLINETEXTMETRIC structure. The following figure shows the difference between the vertical text metric values returned in the NEWTEXTMETRIC and OUTLINETEXTMETRIC structures. (The names beginning with otm are members of the OUTLINETEXTMETRIC structure.) Font Dimensions
An application can retrieve the physical dimensions of a TrueType or OpenType font by calling the GetOutlineTextMetrics function. An application can retrieve the physical dimensions of any other font by calling the GetTextMetrics function. To determine the dimensions of an output device, an application can call the GetDeviceCaps function. GetDeviceCaps returns both physical and logical dimensions. A logical inch is a measure the system uses to present legible fonts on the screen and is approximately 30 to 40 percent larger than a physical inch. The use of logical inches precludes an exact match between the output of the screen and printer. Developers should be aware that the text on a screen is not simply a scaled version of the text that will appear on the page, particularly if graphics are incorporated into the text. =================
MSDN / platform sdk/graphics/windows GDI/fonts and texts/about text output/formating text/String Widths and Heights
里面还有图解,够详细了吧,总不能连代码也帮你写了吧