BCX_FONTDLG function creates a font dialog box in which font attributes can be chosen. These attributes include a typeface name, style (bold, italic, or regular), point size, effects (underline, strikeout, and text color), and a script (or character set).
Syntax:RetVal = BCX_FONTDLG([UseLast AS BOOL][, HndlWnd AS HWND]) Return Value:
Parameters:
|
BCX_FONTDLG also creates a BCX_FONT structure populated with the following members with values derived from the choices made in the font dialog box.
See below for an example of how to retrieve these values.
DIM RetVal% RetVal% = BCX_FONTDLG ' Fill the BCX_FONT structure PRINT "BCX_FONT.Name$ = ", BCX_FONT.Name$ ' Font Name PRINT "BCX_FONT.Size =" , BCX_FONT.Size ' Font Point Size PRINT "BCX_FONT.Italic =" , BCX_FONT.Italic ' Boolean(0 or 1) PRINT "BCX_FONT.Bold =" , BCX_FONT.Bold ' Boolean(0 or 1) PRINT "BCX_FONT.Underline =" , BCX_FONT.Underline ' Boolean(0 or 1) PRINT "BCX_FONT.Strikeout =" , BCX_FONT.Strikeout ' Boolean(0 or 1) PRINT "BCX_FONT.Rgb =" , BCX_FONT.Rgb ' RGB font color
GUI "MiniEd" SUB FORMLOAD GLOBAL Form1 AS CONTROL GLOBAL Edit1 AS CONTROL GLOBAL Button1 AS CONTROL '******************************************************************** Form1 = BCX_FORM ( "Mini-Editor", 0, 0, 125, 105) Edit1 = BCX_EDIT ( " BCX rocks!", Form1, 101, 5, 20, 105, 60) Button1 = BCX_BUTTON( "Change Font", Form1, 102, 35, 3, 40, 13) '******************************************************************** CENTER(Form1) ' Center our Form on the screen SHOW (Form1) ' Display our creation! END SUB BEGIN EVENTS SELECT CASE CBMSG '******************************************************************** CASE WM_COMMAND '******************************************************************** IF CBCTL = 102 THEN CALL SetCustomFont() END IF '******************************************************************** CASE WM_CTLCOLOREDIT '******************************************************************** IF (HANDLE)lParam = Edit1 THEN BCX_SET_EDIT_COLOR(Edit1, BCX_Font.RGB, QBCOLOR(31)) END IF '******************************************************************** CASE WM_CLOSE '******************************************************************** LOCAL id id = MSGBOX("Are you sure?", _ "Quit Program!", _ MB_YESNO OR MB_ICONQUESTION) IF id = IDYES THEN DestroyWindow(hWnd) EXIT FUNCTION END SELECT END EVENTS SUB SetCustomFont () DIM RetVal RetVal = BCX_FONTDLG ' Fill the BCX_FONT structure IF RetVal THEN BCX_SET_FONT(Edit1, BCX_Font.Name$, _ BCX_Font.Size, _ BCX_Font.Bold, _ BCX_Font.Italic, _ BCX_Font.Underline, _ BCX_Font.Strikeout) END IF END SUB