When printing a line, I use this code to print a line in bold:
Code: Select all
@ nPrintRow, nPrintCol PRINT xLine ;
TO nPrintRow, nEndOfLine ;
FONT cFontName SIZE hFontSize BOLD
Thank you all.
Moderator: Rathinagiri
Code: Select all
@ nPrintRow, nPrintCol PRINT xLine ;
TO nPrintRow, nEndOfLine ;
FONT cFontName SIZE hFontSize BOLD
Thank you Rathi ji for the suggestion. In good old DOS days, it seemed easy by just inserting control characters before and after the desired words and you were ready to go. Thank you once again.Rathinagiri wrote: ↑Sun Aug 02, 2020 7:58 pm Another way of doing this:
We can create HTML file and print.
Would be very handy to have this, a bit like CSS in our LABEL controls, like: <font style=color:red;><b> Desired words in red and bold</b></font>inserting control characters before and after the desired words
Hi Serge,serge_girard wrote: ↑Tue Aug 04, 2020 3:28 pmWould be very handy to have this, a bit like CSS in our LABEL controls, like: <font style=color:red;><b> Desired words in red and bold</b></font>inserting control characters before and after the desired words
Code: Select all
/*
* MINIGUI - Harbour Win32 GUI library Demo
*
*/
#include "minigui.ch"
#include "hbclass.ch"
////////////////////////////////////////////////////////////////////////////////
FUNCTION Main()
LOCAL cTxt, aTxt, oLbl
LOCAL h := 0, w := 0, s := 10
LOCAL BColor := { 220, 220, 220 }
LOCAL a, c, y, x
LOCAL cFile := "test.txt"
SET FONT TO "Arial", 12
IF ! File( cFile )
Create_txt( cFile )
ENDIF
cTxt := hb_MemoRead( cFile )
c := iif( CRLF $ cTxt, CRLF, Chr( 10 ) )
aTxt := hb_ATokens( cTxt, c )
DEFINE WINDOW _T ;
AT 0, 0 WIDTH 100 HEIGHT 100 ;
TITLE 'Colored Label Demo' ;
MAIN ;
BACKCOLOR BColor
oLbl := cLbl():New( BColor )
oLbl:Add( 'Harbour', BLUE )
oLbl:Add( 'Project', GREEN, .T., .F., .T. )
oLbl:Add( 'Free', BLUE )
oLbl:Add( 'Software', GREEN, .T., .T., .T., 'Tooltip' )
oLbl:Add( 'General', BLUE )
oLbl:Add( 'Public', YELLOW, .T., .F., .T., 'Click me', .T., ;
{|o| MsgInfo( 'Value: ' + _GetValue( _HMG_ThisControlName, _HMG_ThisFormName ), 'Class: ' + o:ClassName ) } )
oLbl:Add( 'License', BLUE )
oLbl:Add( 'exception', RED )
y := x := s
FOR EACH cTxt IN aTxt
IF ! Empty( cTxt )
oLbl:Def( cTxt )
a := oLbl:Out( y, x )
y += a[ 1 ] + s
h += a[ 1 ] + s
w := Max( w, a[ 2 ] )
ENDIF
NEXT
h += s * 2
w += s * 2
This.Width := w + GetBorderWidth () * 2
This.Height := h + GetBorderHeight() * 2 + GetTitleHeight()
END WINDOW
CENTER WINDOW _T
ACTIVATE WINDOW _T
RETURN NIL
Code: Select all
#include "hmg.ch" // <== New
#include "hbclass.ch"
#include "richtext.ch"
PROCEDURE Main()
RTFDemo()
Return