'font
'   设置用于在控件中绘制文本的字体
'   hWndControl: 控件的句柄 (例如  HWND_FORM1_LABEL1)
'   hFont:       Handle of the font returned from FF_MakeFontEx
Sub FF_Control_SetFont( ByVal hWndControl As HWND, _
                        ByVal hFont As HFONT )
    
   Dim nMargins As Long
   Dim fp As FormControlsPro_TYPE ptr = GetPropW(hWndControl, "FCP_TYPE_PTR")
   if fp then
      fp->nFont = nFont
      '如果这是一个文本框，那么我们需要保存左右边距，以便在设置字体之后可以恢复它们。设置字体会重置为默认页边距。
      If fp->ControlType = 1 Then nMargins = SendMessage(hWndControl, EM_GETMARGINS, 0, 0)
      SendMessage hWndControl, WM_SETFONT, Cast(wParam, gFLY_GetFontHandles(nFont)), True
      If fp->ControlType = 1 Then SendMessage hWndControl, EM_SETMARGINS, EC_LEFTMARGIN Or EC_RIGHTMARGIN, nMargins
   End If       
End Sub

