Page 1 of 1

BT_DrawTextEx() and Text bigger than size

Posted: Mon Nov 30, 2020 3:12 am
by AUGE_OHR
hi,

i use

Code: Select all

   hWnd := GetControlHandle( cLabel, "Form_1" )
   hDC := GetDC( hWnd )
   BT_DrawGradientFillHorizontal( hDC, 0, 0, SP_nCellwide(), nheight, aColor, aMore )
   BT_DrawTextEx( hDC, 0, 0, SP_nCellwide, nheight, cTimeText, ;
               SP_cFontName(), SP_nFontSize(), BLACK, BLACK, ;
               BT_TEXT_TRANSPARENT, BT_TEXT_LEFT + BT_TEXT_TOP, BT_TEXT_NORMAL_ORIENTATION )
Problem : cTimeText is bigger than wide / height and DOES print "outside" :shock:
BT_DrawTextEx.JPG
BT_DrawTextEx.JPG (10.92 KiB) Viewed 601 times
height is just 1 Cell which i have pain using BT_DrawGradientFillHorizontal()
but it paint over 3 Cell ... what are i´m doing wrong :idea:

Re: BT_DrawTextEx() and Text bigger than size

Posted: Mon Nov 30, 2020 3:46 am
by AUGE_OHR
hi,

i "think" i found the Problem in c:\hmg.3.4.4\SOURCE\BosTaurus\c_BosTaurus.c

Code: Select all

   DrawText (hDC, Text, -1, &rect, DT_NOCLIP | DT_WORDBREAK | /*DT_EXTERNALLEADING |*/ DT_NOPREFIX | Align);
it is DT_WORDBREAK 7 DT_NOCLIP ... which is IMHO Part of Align

i recommend to include 2 new Constant

Code: Select all

#define BT_WORDBREAK  0x00000010  // DT_WORDBREAK
#define BT_SINGLELINE 0x00000020  // DT_SINGLELINE
and use

Code: Select all

Function BT_DrawTextEx (hDC, Row, Col, Width, Height, cText, cFontName, nFontSize, aFontColor, aBackColor, nTypeText, nAlingText, nOrientation)
   aFontColor   := IF (ValType(aFontColor)   == "U", BLACK,                        aFontColor)
   aBackColor   := IF (ValType(aBackColor)   == "U", WHITE,                        aBackColor)
   nTypeText    := IF (ValType(nTypeText)    == "U", BT_TEXT_OPAQUE,               nTypeText)
   nAlingText   := IF (ValType(nAlingText)   == "U", (BT_TEXT_LEFT + BT_TEXT_TOP + BT_WORDBREAK * DT_NOCLIP), nAlingText)
   nOrientation := IF (ValType(nOrientation) == "U", BT_TEXT_NORMAL_ORIENTATION,   nOrientation)
   BT_DRAW_HDC_DRAWTEXT (hDC, Col, Row, Width, Height, cText, cFontName, nFontSize, ArrayRGB_TO_COLORREF(aFontColor), ArrayRGB_TO_COLORREF(aBackColor), nTypeText, nAlingText, nOrientation)
Return Nil
and in C-Code

Code: Select all

   DrawText (hDC, Text, -1, &rect, /*DT_EXTERNALLEADING |*/ DT_NOPREFIX | Align);